Get Selected Cell column name

3 Answers 4434 Views
Grid
William
Top achievements
Rank 1
William asked on 25 Jul 2013, 03:18 PM
If I have a Grid with the selection mode cell how can I get the selected cells column name and database field?  I can get the row and all the items on the row but I'm having a bit of trouble finding anything with just the cell information.  It would be nice to get the row and the column index also of the selected cell. I need to create a new grid by filtering with the column field.

Thanks

3 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 26 Jul 2013, 09:31 AM
Hello,

Please try with the below link.

http://stackoverflow.com/questions/17343371/how-to-get-row-index-and-cell-index-of-row-click-kendo-grid/17363488#17363488

Let me know if any concern.

Thanks,
Jayesh Goyani
William
Top achievements
Rank 1
commented on 26 Jul 2013, 11:42 AM

Thanks- that gives the index but how do I get the cells field and column name?  I need the data field for that cell so I can pass in the value as a parameter.

0
Kiril Nikolov
Telerik team
answered on 29 Jul 2013, 07:27 AM
Hi William,

To get the column name you can select the header with the index of the selected cell and get it's text using this line of code:

var colName = $('#grid').find('th').eq(colIdx).text()

I have prepared an example showing a possible implementation of how to see the row index and the column name of a selected cell:

http://jsbin.com/imoqav/1/edit
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Krunal
Top achievements
Rank 1
commented on 25 Jun 2014, 10:15 AM

hello Kiril Nikolov

 .text() return header text

but how to get field name???

please help me
0
Kiril Nikolov
Telerik team
answered on 26 Jun 2014, 08:57 AM
Hello Vinit,

You can get the dataItem on the click, and that dataItem contains all the information about the fields in the current row, as shown in this example:

http://jsbin.com/wujunera/1/edit

If this does not help, please explain in details what exactly are you looking for, so I can further assist you.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Alex
Top achievements
Rank 1
commented on 18 Nov 2016, 05:38 PM

The only problem with this, is that if you have the menu turned on it will include "Column Settings" in the text, which means you have to check if it contains instead of just checking the exact value
Kiril Nikolov
Telerik team
commented on 21 Nov 2016, 08:21 AM

Hi Alex,

Can you please show a sample of the problem in a separate support request? We will be happy to take a look.

Regards,
Kiril Nikolov
Telerik by Progress
Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
William
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Kiril Nikolov
Telerik team
Share this question
or