开发者

get 2 or more column values in a jqgrid row

Is there a way to get the first column value and the second column value in a jqgrid row? I am using this code to get the first value of the row in my other program,

$("#tblTallySheet").jqGrid('getGridParam', 'selrow')

This is to delete a data in my table:

function tallyDelData(){
  var selected = $("#tblTallySheet").jqGrid('getGridParam', 'selrow');  
  var datas = {
    "SessionID": $.cookie("SessionID"),
    "operation": "delete",
    "keyFields": [{"name":"tallyDate", "value":selected}]
  };
  tallyUpdate(datas);
} 

function tallyUpdate(dat){
  $.ajax({
    type: 'GET',
    url: 'processjson.php?' + $.param({path:'tally/update',json:JSON.stringify(dat)}),
    dataType: primeSettings.ajaxDataType,
    success: function(data) {
      if ('e开发者_开发知识库rror' in data)
      {
        showMessage('ERROR: ' + data["error"]["msg"]);
      }
      else{
        $('#tblTallySheet').trigger('reloadGrid'); 
      }
    }
  });
} 

Since my first column is date and that there are datas that have the same date, I'd like to know if the function would only affect on the selected row (note: there are several rows that have the same date)?

If selecting the date row is not good, I want to get the second values which is a plank number (since my program cannot have two same plank number in same date). But how can I do it?

Please help...


You can use getCell method to get the cell contain identified by the column name of the column index. To get contain of all column of the row you can use getRowData method.

The method $('#tblTallySheet').trigger('reloadGrid') which you use in the code reload the full grid and not the selected row. If you need update only one row you can use setRowData.

Currently you send to the server only the id of selected row without any data. Is it what you want or you want include in the datas object more information? I recommend you additionally use cache:false parameter of the $.ajax to be sure that you really end something to the server and not use the previous server response from the cache. Currently in the Internet Explorer you can has the problem.

To give you more advices one have to see the context where the function which you posted are used.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜