How to get data for all rows in jqgrid with pagination

How to get data for all rows in jqgrid with pagination



I want to access grid data as below


var namePresent;
var datafromgrid = $('#MyGrid').jqGrid('getRowData');
for (var i = 0; i < rowCount; i++)
var name = datafromgrid[i].Name;
var firstname = name.split(/ +/);
if (firstname[0].toLowerCase() == Name.toLowerCase())
namePresent = 1;




Now suppose when my grid is loaded with 5 records then this code throws error on line var name = griddata[i].Name; as from grid it is unable to read griddata[5].
Please tell me how to read whole grid data even if it is not visible on screen but is fetched successfully?


name = griddata[i].Name;




4 Answers
4



you can try using :


var allRowsInGrid = $('#list4').jqGrid('getGridParam','data');





WOW!!! You are my HERO!!! Thank you very much!!! I have very customized grid where one cell can have multiple inputs and your code allows me to manipulate local data and then send them to server.
– Michal Vašut
May 4 '15 at 16:28





worked for me also!
– Doctor Parameter
Nov 3 '16 at 19:24



This way is more "pretty":


var allRowsInGrid = $('#list4').getGridParam('data');



This is an alternative way to get the data of a particular row. You can loop over all rows to get everything:


var dataIDs = grid.getDataIDs();
for(i = 0; i < dataIDs.length; i++)

var rowData = grid.jqGrid ('getRowData', dataIDs[i]);
//rowData is object containing keys & values for row
console.log(rowData);



After digging into the documentation, found this straight forward way.


var allRowsInGrid = $('#list4').getGridParam('data');



This returns you a JavaScript Array Object. To check the values in JS Object you can simply use following way.


var stringVersion = JSON.stringify(allRowsInGrid);

alert (stringVersion);






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ

How do I collapse sections of code in Visual Studio Code for Windows?