Set Selected Item and Show It

6 posts, 0 answers
  1. Gil
    Gil avatar
    9 posts
    Member since:
    Jun 2016

    Posted 29 Sep Link to this post

    It is possible to set the selection in a grid with paging and to show the page with the selection when the grid is initialized.
  2. Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 03 Oct Link to this post

    Hello Gil,

    You can use the select method to achieve this requirement:
    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-select

    In addition, I am also sending a sample application to demonstrate a paging-preserving logic for the selected items:
    http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Selection/grid-selection-checkbox

    Please add the Kendo MVC dll assemblies to the bin folder and run the attached application to see whether it will help you.

    Regards,
    Eyup
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Gil
    Gil avatar
    9 posts
    Member since:
    Jun 2016

    Posted 10 Oct in reply to Eyup Link to this post

    Hi Eyup,

    thanks for your advice. Unfortunately, I still don't know how to do it. 

    I have for instance an item that is on page 10. When the control is initialized,

    it should show page 10 and select the item. I wonder, how this can be done,

    when the selection seems to be restricted to the items that are currently loaded.

     

    Regards

    Gil

  5. Gil
    Gil avatar
    9 posts
    Member since:
    Jun 2016

    Posted 10 Oct in reply to Eyup Link to this post

    Hi Eyup,
    thanks for your advice. Unfortunately, I still don't know, how to do it.

    For instance, I have an item, that is on page 10. When the control is loaded,
    it should show page 10 and select that item. I wonder, how this can be done,
    when the selection is restricted to the items that are currently loaded.

    Regards

    Gil
     
  6. Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 12 Oct Link to this post

    Hi Gil,

    The grid is not able to tell on which page is the record is located automatically by its unique record ID. You will need to determine this manually from your database queries and set the default page accordingly:
    http://www.telerik.com/forums/setting-initial-grid-page#k6e-hGAqBUWRzMre1eUsyQ
    http://www.telerik.com/forums/set-initial-grid-page-so-it-displays-page-other-than-first-page
    http://stackoverflow.com/questions/13740339/kendo-ui-grid-mvc-initial-page
    http://stackoverflow.com/questions/13976496/how-to-change-kendo-ui-grid-page-index-programmatically


    Once the record is among the loaded 10 items, you can now find it and use the select method:
    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-select


    Regards,
    Eyup
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Gil
    Gil avatar
    9 posts
    Member since:
    Jun 2016

    Posted 12 Oct in reply to Eyup Link to this post

    Hi Eyup,

    thank you for your help. I will give it a try.

    Regards

    Gil

Back to Top
UI for ASP.NET MVC is VS 2017 Ready