سؤال

I am trying to update Jqgrid data update on live function click But not updating data.

I have tried jQuery('grid').jqGrid('clearGridData'); jQuery('grid').jqGrid('setGridParam', {data: dataToLoad}); jQuery('grid').trigger('reloadGrid');

also here is my grid code it is in a function and i am calling this function for each buttun click

  jQuery("#procedureResultGrid").jqGrid({
       loadonce:false,
    rowList : [ 10, 20, 50,100 ],
       data : jsonText,
       datatype : 'local',
       gridview: true,
       rowNum : 10,
       width : '100%',
       height : 'auto',
       colModel : [{
           name : 'name',
           sortable:false,
           width : 130,
           classes: "col1"
       },{
           name : 'rowv_1',
           formatter: valueFormatFunctionFirst,
           width : 60,
           sortable:false
       }
       ,{

           name : 'row1',
           width : 25,
           formatter: calculatedFormatFunctionFirst,
           classes: "imageValue"


       },{

           name : 'row4',
           width : 50,
           formatter: calculatedPersendFunctionFirst,
           classes: "persendValue"

        },{
           name : 'rowv_2',
           formatter: valueFormatFunctionSecond,
           width : 60,
           sortable:false
       }
       ,{

           name : 'row3',
           width : 25,
           formatter: calculatedFormatFunctionSecond,
           classes: "imageValue"

       },{

       name : 'row4',
       width : 50,
       formatter: calculatedPersendFunctionSecond,
       classes: "persendValue"
    }
       ,{
           name : 'rowv_3',
           width : 60,
           formatter: valueFormatFunctionThird,
           sortable:false
       }
       ,{

           name : 'row5',
           width : 25,
           formatter: calculatedFormatFunctionThird,
           classes: "imageValue"

       },{

       name : 'row6',
       width : 50,
       formatter: calculatedPersendFunctionThird,
       classes: "persendValue"

    }
       ,{
           name : 'rowv_4',
           formatter: valueFormatFunctionForth,
           width : 60,
           sortable:false
       }
       ,{

           name : 'row5',
           width : 25,
           formatter: calculatedFormatFunctionForth,
           classes: "imageValue"

       },{

       name : 'row6',
       width : 50,
       formatter: calculatedPersendFunctionForth,
       classes: "persendValue"

    },{
        name : 'rowv_4',
        formatter: valueFormatFunctionYTD,
           width : 60,
           sortable:false
       }
       ,{

           name : 'row5',
           width : 25,
           formatter: calculatedFormatFunctionYTD,
           classes: "imageValue"

       },{

       name : 'row6',
       width : 50,
       formatter: calculatedPersendFunctionYTD,
       classes: "persendValue"

    }
       ],
       pager : jQuery('#pager'),
       afterInsertRow: function (rowid, rowdata) {
    if(rowid%2==0)
           $("#procedureResultGrid").jqGrid('setRowData', rowid, false, { background: '#F2F2F2' });
        else
            $("#procedureResultGrid").jqGrid('setRowData', rowid, false, { background: 'white' });
       }

   });

   $("#procedureResultGrid").fluidGrid({
       base : "result-grid",
       offset : -20
   });

   $("#pager").show();
          $("#procedureResultGrid").setGridParam({datatype:'local',sortname:'values.aggregate.'+totalCostIndex+'.data.'+addKeyYear(keyYear), sortorder: 'desc'}).trigger('reloadGrid');

I am also try sort it is also not working.

هل كانت مفيدة؟

المحلول

I just added from create grid and

 $("#procedureResultGrid").GridUnload();

then

   $("#procedureResultGrid").trigger('reloadGrid');

working fine for me..

Thanks

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top