Grid local data add data and update grid

4 posts, 1 answers
  1. Gavidia Gonzalez
    Gavidia Gonzalez avatar
    4 posts
    Member since:
    Feb 2016

    Posted 02 Mar 2016 Link to this post

    Hi,

    i have a question, i have a grid populated with local data (array of data), i need to insert more rows to my data array and then refresh the grid without the Grid redraw all the items. For example if i have 20 items on my grid and into my data array and then the user execute load more (other 20), into my code  load the 20 more records into my array data (pushing) and the dataBound event is fired. Then the Grid takes the 40 records again not just the 20 more.

    Can some one help me?

    Sorry about my english.

    Thanks in advance.

  2. Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 04 Mar 2016 Link to this post

    Hi,

    If I understand you correctly, the best approach in that case would be to re-assign the data of the data source with the new items. This will remove the previously visible ones and show the new items.

    Apart from that, the grid will always re-draw itself when the datasource contents are changed - there are no means to avoid that. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Gavidia Gonzalez
    Gavidia Gonzalez avatar
    4 posts
    Member since:
    Feb 2016

    Posted 07 Mar 2016 in reply to Petyo Link to this post

    Hello, thanks for the answer.

    I am changing the grid implementation. Now the data comes from a direct connection (trhourg transport read method) with a remote service (Delphi with Indy components). In this scneario I wonder if the virtual scrolling draw just the new items and I can add attributes to each one.

    I am implementing an eccomerce portal so I need to display always all the items but loading them by parts, this why the virtual scrolling is (I guess) what i need.

    Thanks in advance.

  4. Answer
    Petyo
    Admin
    Petyo avatar
    2444 posts

    Posted 10 Mar 2016 Link to this post

    Hello,

    the virtual scrolling of the grid dynamically removes and adds several items given the scroll behavior. Relying on items being present in the DOM (or not being redrawn) is nto a good idea. Notice that items further above the scroll area are removed for performance reasons. As a matter of fact, you can observe this behavior with your browser developer tools.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top