Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appendgrid - Getting grid data as a JSON Object instead of regular serialization

In the example listed here, how can I get the grid data as JSON?

Reference Link

The JQuery Serialize works, but it would be nice if I am able to get each row as a JSON Object, so I can parse the data.?

like image 706
Jake Avatar asked Jun 24 '14 13:06

Jake


1 Answers

You can use the .appendGrid('getAllValue') function to get the grid data as javascript objects. You can parse them directly or encode them as JSON.

Example:

var data = $('#tblAppendGrid').appendGrid('getAllValue') returns an array where each element is the data from one table row as object.

data[0] will be the first row.

JSON.stringify(data) will be a JSON string with all the data from your table

like image 176
Martin Avatar answered Nov 21 '22 00:11

Martin