how to get a value of a (hidden) column, from the selected row. that is, the cell value needs to be from the cell identied by colName, and the selected row (not using multi select). From the API i see the method getGridParam("selrow") for reading the row, may be able to combine with other methods.. but, any convenient method available? a code snippet would save lot of time... \ thanks.
Asked
Active
Viewed 3.3k times
1 Answers
32
You should use getCell
function to read the value from the cell identified by row id. So if you need a data from the column 'MyColName' of selected row you can do this with the following code:
var grid = jQuery('#list');
var sel_id = grid.jqGrid('getGridParam', 'selrow');
var myCellData = grid.jqGrid('getCell', sel_id, 'MyColName');
If you need read full data of a row you can use getRowData
instead of getCell
. More about methods supported by jqGrid you can read in the documentation (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods).

Oleg
- 220,925
- 34
- 403
- 798
-
Hello, I'll treat the question as answered as it was direct. I get the cell value as null though (see the below qn). but, my real issue is unsolved, which I formulated as another qn.http://stackoverflow.com/questions/3024075/jqgrid-navigation-based-on-the-selected-row. hope ur expertise would help me. – bsr Jun 11 '10 at 15:28
-
I don't understand why you receive null value. Do you not filled it or you ask the value BEFORE the value is filled? (for example, not inside of `loadComplete` or `gridComplete`). Or you have other problem? – Oleg Jun 11 '10 at 16:02
-
the data wasn't there because of the JSON response wasn't correct.. and it worked great after.. thanks – bsr Jun 11 '10 at 17:08
-
@Oleg, sir, could you please help this https://stackoverflow.com/questions/45752959/how-to-prevent-selecting-a-dropdown-based-on-cell-value-condition-in-jqgrid – davidb Aug 18 '17 at 09:39