How to return jqgrid data of selected rows

shaan N

In JQGrid

 var gridData=$("#SearchResults").jqGrid('getRowData')

The above line gives you the grid data of all the rows, is there a way where I can get the grid data of only the selected rows.

selRowId = myGrid.jqGrid ('getGridParam', 'selrow'),

The above gives the selected row IDs but I want the data as well of all the selected rows as it returns with gridData but I need only of those of selected one

Oleg

It's very simple. The second optional option parameter of getRowData method is rowid of the row which data is requested (see the documentation). So you can use

var selRowId = myGrid.jqGrid("getGridParam", "selrow");

to get last selected rowid first and then get the data of the row by

var rowData = myGrid.jqGrid("getRowData", selRowId);

If you use datatype: "local" or some remote datatype ("xml" or "json"), but with loadonce: true then jqGrid hold the data internally in data array. In the case the usage of getLocalRow method is more effective as the usage of getRowData:

var rowData = myGrid.jqGrid("getLocalRow", selRowId);

If you use multiselect: true option then jqGrid supports selarrrow array of selected rowids and you can get all required data in the loop:

var i, selRowIds = myGrid.jqGrid("getGridParam", "selarrrow"), n, rowData;
for (i = 0, n = selRowIds.length; i < n; i++) {
    rowData = myGrid.jqGrid("getLocalRow", selRowIds[i]);
    // one can uses the data here
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jqgrid - Delete multiple selected rows

From Dev

How to get row ID by row Data in jqgrid (Not by selected row)

From Dev

How to delete rows in jqgrid

From Dev

How to show too many rows data with JSON in jqGrid

From Dev

How to show all rows in jqGrid?

From Dev

Populate jqgrid with only selected xml data

From Dev

Populate jqgrid with only selected xml data

From Dev

How to add dynamically rows using ajax return type is json with first row position? In JQgrid

From Dev

How to return rows of data from a table with json?

From Dev

How can i set the selected index with data from server to a combobox in a jqgrid

From Dev

Jqgrid - Fetch total number of selected rows using Select All

From Dev

jqGrid: function $("#gridView").jqGrid("getGridParam", "data") return null?

From Dev

How to get data from all selected rows in datatable?

From Dev

How to collect data for the rows that have been selected in AngularJS?

From Dev

jqGrid onCellSelect Return Property from Local Data

From Dev

How to populate select options with unique data and return a value as selected item?

From Dev

(flask) python mysql - how to pass selected data though a for loop and return it?

From Dev

How to load data in pagewise - jqGrid?

From Dev

How to display indirect data in Jqgrid

From Dev

how to drop jqgrid row between not draggable rows

From Dev

How to show jqGrid subgrid on certain rows only?

From Dev

how to drop jqgrid row between not draggable rows

From Dev

How to categorize rows in the free grid jqgrid?

From Dev

How to dynamically bind and rows and column in JqGrid?

From Java

In R, how do I match values from selected rows in one data frame with selected columns in another?

From Dev

How to return a single row aggregating data in multiple rows in SQL

From Dev

How to return 3 rows always even if there is no enough data

From Dev

How to group data in jqgrid depending on column data

From Dev

How to delete selected rows in uitable?

Related Related

  1. 1

    jqgrid - Delete multiple selected rows

  2. 2

    How to get row ID by row Data in jqgrid (Not by selected row)

  3. 3

    How to delete rows in jqgrid

  4. 4

    How to show too many rows data with JSON in jqGrid

  5. 5

    How to show all rows in jqGrid?

  6. 6

    Populate jqgrid with only selected xml data

  7. 7

    Populate jqgrid with only selected xml data

  8. 8

    How to add dynamically rows using ajax return type is json with first row position? In JQgrid

  9. 9

    How to return rows of data from a table with json?

  10. 10

    How can i set the selected index with data from server to a combobox in a jqgrid

  11. 11

    Jqgrid - Fetch total number of selected rows using Select All

  12. 12

    jqGrid: function $("#gridView").jqGrid("getGridParam", "data") return null?

  13. 13

    How to get data from all selected rows in datatable?

  14. 14

    How to collect data for the rows that have been selected in AngularJS?

  15. 15

    jqGrid onCellSelect Return Property from Local Data

  16. 16

    How to populate select options with unique data and return a value as selected item?

  17. 17

    (flask) python mysql - how to pass selected data though a for loop and return it?

  18. 18

    How to load data in pagewise - jqGrid?

  19. 19

    How to display indirect data in Jqgrid

  20. 20

    how to drop jqgrid row between not draggable rows

  21. 21

    How to show jqGrid subgrid on certain rows only?

  22. 22

    how to drop jqgrid row between not draggable rows

  23. 23

    How to categorize rows in the free grid jqgrid?

  24. 24

    How to dynamically bind and rows and column in JqGrid?

  25. 25

    In R, how do I match values from selected rows in one data frame with selected columns in another?

  26. 26

    How to return a single row aggregating data in multiple rows in SQL

  27. 27

    How to return 3 rows always even if there is no enough data

  28. 28

    How to group data in jqgrid depending on column data

  29. 29

    How to delete selected rows in uitable?

HotTag

Archive