Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:50:24+00:00 2026-05-25T09:50:24+00:00

Edit formatter action button is placed to jqgrid column: colModel: [{fixed:true,label: change ,name:_actions,width:($.browser.webkit ==

  • 0

Edit formatter action button is placed to jqgrid column:

colModel: [{"fixed":true,"label":" change ","name":"_actions","width":($.browser.webkit == true? 37+15: 32+15)
    ,"align":"center","sortable":false,"formatter":"actions",
"formatoptions":{"keys":true,"delbutton":false,"onSuccess":function (jqXHR) {actionresponse = jqXHR;return true;}
    ,"afterSave":function (rowID) {
    cancelEditing($('#grid'));afterRowSave(rowID,actionresponse);actionresponse=null; }
    ,"onEdit":function (rowID) {
      if (typeof (lastSelectedRow) !== 'undefined' && rowID !== lastSelectedRow)
        cancelEditing($('#grid'));
        lastSelectedRow = rowID;
        }
    }}

New row is added to jqgrid in loadcomplete event

var newRowData = {};
var newRowId = '_empty' + $.jgrid.randId();
$('#grid').jqGrid('addRowData', newRowId, newRowData);

and its id is updated if save action button is clicked:

function aftersavefunc(rowID, response) {
    restoreActionsIcons();
    $('#grid').jqGrid('resetSelection');
    var json = $.parseJSON(response.responseText);
    $("#" + rowID).attr("id", json.Id);
    lastSelectedRow = json.Id; 
    $("#grid").jqGrid('setSelection', lastSelectedRow);
}

After clicking save action button edit action button clicks are ignored. It is not possible to re-enter to edit mode after first editing.

How to fix this so that row can edited by edit button click again after saving ?

Update

I added $(this).focus() as suggested in Oleg answer and also wrapped id change into setTimeout as Oleg recommends in other great answer:

function aftersavefunc(rowID, response) {
    restoreActionsIcons();
    $(this).focus();
    $('#grid').jqGrid('resetSelection'); 
    var json = $.parseJSON(response.responseText);
    setTimeout(function () {
        $("#" + rowID).attr("id", json.Id);
        lastSelectedRow = json.Id;
        $("#grid").jqGrid('setSelection', lastSelectedRow);
    }, 50);
}

Problem persists. The problem may related to row id change since:

  1. It occurs only in last row (where id is changed after save). It does not occur for saved rows where responseText returns same id and row id is actually not changed.
  2. It does not occur if cancel action button is pressed.

Maybe row id needs additional reset id addition to resetSelection or needs updated in somewhere other place also.

Update2

I added code form updated answer to errorfunc and used only english characters and numbers id ids. This allows to click multiple times but introduces additional issue:

extraparam is no more passed. If rowactions() calls are commented out, extraparam is passed with with rowactions calls extraparam is not passed.

I changed jqGrid source code and added alert to rowactions method:

alert( cm.formatoptions);
if (!$.fmatter.isUndefined(cm.formatoptions)) {
  op = $.extend(op, cm.formatoptions);
  }

In first clicks alert outputs ‘Object’. In succeeding clicks to Save button it outputs undefined. So for unknown reason formatoptions is cleared.

Remarks to comment:

  1. Absolute url in testcase is not used. Datasource is set to localarray.
    I verified that testcase works in IE and FF without external url access.
    For extraparam issue I can create new testcase.

  2. Without image directory buttons are shown in cursor is moved over them.
    Missing image directory still allows to reproduce the issue.

  3. FormData function is defined in js file.

Since new issue occurs after adding rowactions() calls and does not occur if those calls are removed, this seems to be related to the code proposed in answer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:50:24+00:00Added an answer on May 25, 2026 at 9:50 am

    I suppose that the problem exist because one hide a button which has currently focus. Look at the code from the answer. If one remove the line $(this).focus(); // set focus somewhere one has the same problem as you describes. So I suggest that you just try to set somewhere, for example in restoreActionsIcons the focus to any the table element of the grid after hiding the button having currently the focus. I can’t test this, but I hope it will help.

    UPDATED: I examined your problem one more time and I hope I can suggest you a solution.

    You problem can be divided on two sub-problems. The main your problem is the the changing of the id of the row. So it is not common problem which everybody has.

    The problem is that “actions” formatter create onclick functions directly in the HTML code (see for example here):

    ocl = "onclick=$.fn.fmatter.rowactions('"+rowid+"','"+opts.gid+"','edit',"+opts.pos+");..."
    

    So the functions will contains the original rowid. To fix the problem you can modify the code fragment of your aftersavefunc inside of setTimeout from

    $("#" + rowID).attr("id", json.Id);
    lastSelectedRow = json.Id;
    $("#grid").jqGrid('setSelection', lastSelectedRow);
    

    to something like the following:

    var $tr = $("#" + rowID),
        $divEdit = $tr.find("div.ui-inline-edit"),
        $divDel = $tr.find("div.ui-inline-del"),
        $divSave = $tr.find("div.ui-inline-save"),
        $divCancel = $tr.find("div.ui-inline-cancel");
    
    $tr.attr("id", json.Id);
    if ($divEdit.length > 0) {
        $divEdit[0].onclick = function () {
            $.fn.fmatter.rowactions(newId,'grid','edit',0);
        };
    }
    if ($divDel.length > 0) {
        $divDel[0].onclick = function () {
            $.fn.fmatter.rowactions(newId,'grid','del',0);
        };
    }
    if ($divSave.length > 0) {
        $divSave[0].onclick = function () {
            $.fn.fmatter.rowactions(newId,'grid','save',0);
        };
    }
    if ($divCancel.length > 0) {
        $divCancel[0].onclick = function () {
            $.fn.fmatter.rowactions(newId,'grid','cancel',0);
        };
    }
    lastSelectedRow = json.Id;
    $("#grid").jqGrid('setSelection', lastSelectedRow);
    

    The second problem is that you use special characters inside of ids. I found a bug in the $.fn.fmatter.rowactions which need be fixed to support special characters in ids. The problem is that in the line 407 of jquery.fmatter.js the original rowid parameter rid will be changed:

    rid = $.jgrid.jqID( rid )
    

    and later everywhere will be used modified id. For example in the id is my.id the encoded version will be my\\.id. It’s correct for the most places of the $.fn.fmatter.rowactions code (see here), but it’ s incorrect as the rowid parameter of the editRow, saveRow, restoreRow, delGridRow, setSelection and editGridRow (see the lines 433–453). So the code must be fixed to use the original not escaped (not encoded) rid value with which the $.fn.fmatter.rowactions was called.

    I think I will post tomorrow the corresponding bug report with the suggestions in the trirand forum.

    UPDATED 2: The code $.fn.fmatter.rowactions(newId,'grid','edit',0); which I wrote above is just an example. I took it from the test demo which you send me. You should of course modify the code for your purpose. How you can see for example from the line the second parameter of the $.fn.fmatter.rowactions in the id of the grid which you use: ‘grid’, ‘list’ of something like myGrid[0].id. The last parameter should be the index of the column having formatter:'actions' in the colModel. You can use getColumnIndexByName function from the answer on your old question to get the index by column name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Action buttons are added to jqGrid columns using colmodel below. Column width 45 is
Inline editing is started using edit formatter action button. If clicked in other row,
jqGrid delete action button is used to delete row. This button click calls Edit
Experts, I have JQGrid with custom template column like Edit. the following screen display
Normally in a jqGrid edit form, every field is on a separate line, label
I'm using the built-in 'action' formatter to edit inline (row editing) and to delete.
What formatter is used for boolean values? EDIT: Example: NSLog(@ ??, BOOL_VAL); , what
I want to display a combobox with add/edit dialog on Jqgrid. I could do
I am trying to use the edit delete functions in jqgrid. I can't seem
I've implemented a jqgrid with inline edit: var lastSel; jQuery(document).ready(function () { jQuery(#list).jqGrid({ url:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.