This is a migrated thread and some comments may be shown as answers.

get all cell values

3 Answers 4041 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 10 Jan 2020, 08:56 PM

Is there a way to get a value of all cell 1 for every row within the grid without selecting a row on button click?

I want to grab all of the ID's without selecting a row so I can pass those Id's to another function

Grid looks like this
 
id                     Name
1                      Stewart
2                      Jones
3                      Smith
4                      Johnson

3 Answers, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 13 Jan 2020, 10:15 AM

Hello, George,

To get the bound dataItem to a row when you click a button, you can use the dataItem() method as demonstrated in this click handler:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.command#columnscommandclick

Alternatively, if the button is outside of the grid, you can use the items() method to get all the rows and loop them to obtain the corresponding dataItem.

Finally, you could also use the dataSource view() dependent on the full use case.

In case you need further assistance, please give some more details about the desired outcome, perhaps accompanied with a description of steps or a screenshot.

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
George
Top achievements
Rank 1
answered on 16 Jan 2020, 02:40 PM

That's only for the row, what I need is to get the ID field for every row so I can pass it to another function in my code.

0
Alex Hajigeorgieva
Telerik team
answered on 20 Jan 2020, 08:58 AM

Hello, George,

It is not clear to me if the ids are needed on click of the columns command, however the easiest way to get the ids of items in the current view of rows is via the data source:

var itemIds = grid.dataSource.view().map(item=>item.id));

See this updated Dojo for your reference:

https://dojo.telerik.com/@bubblemaster/eHiReSaM/2

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
George
Top achievements
Rank 1
Share this question
or