开发者

How to provide immediate feedback if save action button is clicked in jqgrid

开发者 https://www.devze.com 2023-04-02 20:21 出处:网络
Edit action button is added to jqGrid row using code below. After editing if Save action button is clicked, nothing happens, Save button remains active.

Edit action button is added to jqGrid row using code below. After editing if Save action button is clicked, nothing happens, Save button remains active. Save takes some time and it looks like click is ignored. Users clicks save button again and again.

How to provide immediate feedback after Save button is clicked and before save is finished: change save button icon to saving animation, remove possibility to click it again, show saving message ? jqueryUI is used.

colModel: [{"fixed":true,"label":" change ","name":"_actions","width":($.browser.webkit == true? 37+15: 32+15)
    ,"align":"center","sortable":false,"for开发者_JAVA百科matter":"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;
        }
    }}

Update

FireFox makes grid inactive (grays out) properly if saved in both ways in inline edit without any code. So it seems like IE issue.

How to gray out jqGrid in IE 9 also ?


If I understand you correct your problem is not problem of 'actions' formatter. The same problem you have in inline editing if the user just press "Enter" and the row should be saved on the server. There are no direct event which will be fire before the ajax request to the server.

Nevertheless there are different indirect possibilities to receive control and to display the "Saving..." message for the user. The simplest way is to use serializeRowData to display the message. You should not forget to close the "Saving..." div in both errorfunc and successfunc methods.

0

精彩评论

暂无评论...
验证码 换一张
取 消