admin管理员组文章数量:1290978
I am following this tutorial here .html in LiveDataManipulation->EditRow
My grid receive data from script a.php
. After the user can modify this data by the jqGrid.
jqGrid after the modification data will send data to script B.php
that update my database and return a message of response like "all goes well".
I want that this response is alerted or showed to user somewhere on the page.
Reading the tutorial and here .php?id=wiki:form_editing I think that I've to use afterSubmit
option, but I haven't understood how print on the edit panel the result.
I have written:
$("#editImpresa").click(function(){
var gr = jQuery("#tabImprese").jqGrid('getGridParam','selrow');
if( gr != null ) jQuery("#tabImprese").jqGrid('editGridRow',gr,{
height:690,
width:500,
closeAfterEdit : true,
reloadAfterSubmit:false,
afterSubmit: function(response,postdata){
if(response.responseText=="ok")
success=true;
else success = false;
return [success,response.responseText]
}
});
How can I do it? Thanks.
I am following this tutorial here http://www.trirand./blog/jqgrid/jqgrid.html in LiveDataManipulation->EditRow
My grid receive data from script a.php
. After the user can modify this data by the jqGrid.
jqGrid after the modification data will send data to script B.php
that update my database and return a message of response like "all goes well".
I want that this response is alerted or showed to user somewhere on the page.
Reading the tutorial and here http://www.trirand./jqgridwiki/doku.php?id=wiki:form_editing I think that I've to use afterSubmit
option, but I haven't understood how print on the edit panel the result.
I have written:
$("#editImpresa").click(function(){
var gr = jQuery("#tabImprese").jqGrid('getGridParam','selrow');
if( gr != null ) jQuery("#tabImprese").jqGrid('editGridRow',gr,{
height:690,
width:500,
closeAfterEdit : true,
reloadAfterSubmit:false,
afterSubmit: function(response,postdata){
if(response.responseText=="ok")
success=true;
else success = false;
return [success,response.responseText]
}
});
How can I do it? Thanks.
Share Improve this question edited Aug 25, 2014 at 16:29 Volker E. 6,04411 gold badges49 silver badges66 bronze badges asked Jul 22, 2011 at 14:25 michelemichele 26.6k31 gold badges118 silver badges173 bronze badges 4- I want show the message result in the jqgrid panel where I can edit a row. – michele Commented Jul 22, 2011 at 15:00
- What you mean under "jqgrid panel"? – Oleg Commented Jul 22, 2011 at 15:10
- here in this panel: imageshack.us/photo/my-images/832/immaginae.png – michele Commented Jul 22, 2011 at 15:19
- Do you mean the edit form? Do you want to form will be not closed and you show an text message somewhere in the form dialog? – Oleg Commented Jul 22, 2011 at 15:22
1 Answer
Reset to default 6First of all the option closeAfterEdit:true
follows to closing of the edit form after the successful server response. You should change the setting to the default value closeAfterEdit:false
to be able to show anything.
Next I would remend you to use navigator toolbar instead of creating a button after outside of the grid. In the case you can use
var grid = jQuery("#tabImprese");
grid.jqGrid('navGrid','#pager', {add:false,del:false,search:false}, prmEdit);
One more good option is to use ondblClickRow
event handler
ondblClickRow: function(rowid) {
$(this).jqGrid('editGridRow',rowid,prmEdit);
}
(see here) or both ways at the same time.
In any way you have to define the options of editGridRow method (the prmEdit
). It's important to know that afterSubmit will be called only if the server response not contains error HTTP status code. So you should use errorTextFormat to decode the error server response. The afterSubmit event handler you can use to display status message.
In the demo I used only errorTextFormat
to demonstrate both displaying of the status and error message:
The status message goes away in 3 seconds:
The corresponding demo you will find here.
In real example you will of cause place the code writing status message inside of afterSubmit event handler and the code which returns the error message inside of errorTextFormat.
本文标签: javascriptjQuery jqGrid Show message when an edit row is completeStack Overflow
版权声明:本文标题:javascript - jQuery jqGrid Show message when an edit row is complete - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741523732a2383344.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论