Get Selected Cell column name

8 posts, 0 answers
  1. William
    William avatar
    55 posts
    Member since:
    Sep 2008

    Posted 25 Jul 2013 Link to this post

    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
  2. Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 26 Jul 2013 Link to this post

    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
  3. Kendo UI is VS 2017 Ready
  4. William
    William avatar
    55 posts
    Member since:
    Sep 2008

    Posted 26 Jul 2013 Link to this post

    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.

  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 29 Jul 2013 Link to this post

    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!
  6. Krunal
    Krunal avatar
    13 posts
    Member since:
    Mar 2014

    Posted 25 Jun 2014 Link to this post

    hello Kiril Nikolov

     .text() return header text

    but how to get field name???

    please help me
  7. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 26 Jun 2014 Link to this post

    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!
     
  8. Alex
    Alex avatar
    20 posts
    Member since:
    May 2015

    Posted 18 Nov in reply to Kiril Nikolov Link to this post

    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
  9. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 21 Nov Link to this post

    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.
Back to Top
Kendo UI is VS 2017 Ready