Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change a row's particular cell value in jqgrid

I want to change a particular rows's cell value, I have the row Id. and I have tried using the following. But it doesnt work.

$("#my-jqgrid-table").jqGrid('setCell',rowId,'Currency', '12321');

I am using loadonce: true

Please can someone help me with this. Thanks

like image 836
Yasser Shaikh Avatar asked Oct 01 '12 13:10

Yasser Shaikh


People also ask

How do I get the value of a jqGrid cell?

How to get a cell value in JQGrid? var ret = jQuery("#MyGrid"). jqGrid('getRowData', id); ret = ret.

What is rowNum in jqGrid?

jqGrid exposes a property rowNum where you can set the number of rows to display for each page.

How do I add edit and delete button for jqGrid for every row?

Mention editLink and deleteLink in colModel name of edit and delete for display Edit and Delete button in jqgrid for each row. Show activity on this post. I got it, Just take additional column, and add formaater actions as model class. That's it.

How do I highlight a row in jqGrid?

If the row which you need highlight has the id 123 you can just use setSelection method for selecting: jQuery('#tab_Categorize'). jqGrid('setSelection', '123');


2 Answers

You can use getRowData and setRowData methods to achieve this (they are working directly with data array):

var rowData = $('#my-jqgrid-table').jqGrid('getRowData', rowId);
rowData.Currency = '12321';
$('#my-jqgrid-table').jqGrid('setRowData', rowId, rowData);
like image 189
tpeczek Avatar answered Oct 17 '22 14:10

tpeczek


Here is the correct way according to the documentation :-

$("#my-jqgrid-table").jqGrid("setCell", rowid, "Currency", "New value");

Check that all variables are correct as what you did seems correct. loadOnce has no impact, you must have a mistake elsewhere.

  • Are you sure the row name is Currency (not the index)
  • Check the variable rowId, should it be rowid or rowID
like image 23
Justin Levene Avatar answered Oct 17 '22 12:10

Justin Levene