Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How I can retrieve data from jqgrid row, if I have only the number of the row?

For example, what do I have to do if I want the id column of the 3rd row?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
238 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can get the data by row id. So you can do following:

var index = 2; // zero-based index of row so it means the 3rd row
var rowId = jQuery('#list tr:eq('+index+')').attr('id');

(here I suppose that the <table> element of your jqGrid has id="list"). After you know the id of the row you can get the row data with respect of getRowData method or the data from one cell only with respect of getCell method:

var dataFromTheRow = jQuery('#list').jqGrid ('getRowData', rowId);
var dataFromCellByColumnIndex = jQuery('#list').jqGrid ('getCell', rowId, 7);
var dataFromCellByColumnName = jQuery('#list').jqGrid ('getCell', rowId, 'Tax');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...