jqGrid - Default Add/Edit buttons - Processing Server Response

前端 未结 3 1724
孤街浪徒
孤街浪徒 2020-12-16 15:15

I am working on my first implementation of a jqGrid. I am using the standard add/edit buttons that appear in the navGrid but am having problems identifying how process the s

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 15:46

    There are a few ways I have seen to do this:

     jQuery("#search_results").jqGrid({
            url: host,
            datatype: "xml", 
            mtype: "GET", // Handy to see the params passed.
            height: 200,
            width: 500,
    ...
    ...
    etc
            gridComplete: function() {
              var ids = jQuery("#search_results").getDataIDs();
              if (ids.length Empty Result

    '); } else { $('#jqgrid_error').hide(); } }, loadError: function(xhr,st,err) { jQuery("#jqgrid_error").html("Type: "+ st +"; Response: "+ xhr.status + " "+xhr.statusText+'

    '); } }).navGrid('#search_results_pager', {edit:true,add:false,del:false,search:true}, { afterComplete:processed, // processed is a function you define closeAfterEdit: true, reloadAfterSubmit:true } );

    From the documentation:

    afterComplete This event fires immediately after all actions and events are completed  and the row is inserted or updated in the grid. afterComplete(serverResponse, postdata, formid) where

    • response is the data returned from the server (if any)
    • postdata an array, is the data sent to the server  
    • formid is the id of the form  

    gridComplete This fires after all the data is loaded into the grid and all other  processes are complete.

    loadError xhr,st,err A function to be called if the request fails. The function gets passed  three arguments: The XMLHttpRequest object (XHR), a string  describing the type of error (st) that occurred and an optional  exception object (err), if one occurred.

    There is a handy/helpful PDF documents (a little dated): http://www.scribd.com/doc/17094846/jqGrid.

提交回复
热议问题