DataBounded event

6 posts, 1 answers
  1. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 25 Oct 2013 Link to this post

    Hello,

    A while a go, posted this question about how to select a row after a grid refresh.

    The answer given back then was a great workaround.  However, once deployed in production with large amount of data, I realized many client's grid were not loaded within 50 milliseconds, leaving the first row unselected.

    Increasing the delay might fix the problem for some people but how long should we wait to make sure every grids are loaded?  In the other hand, I don't want to add transform my problem into unnecessary.

    What's missing here is an event triggered by the Grid.

    Is there a way to create an event named DataBounded (or AfterDataBound) that would fired once the grid will complete the loading of the data received from the dataSource?

    Best regards,

    Simon
  2. nikobellic
    nikobellic avatar
    46 posts
    Member since:
    Feb 2013

    Posted 25 Oct 2013 Link to this post

    Yes there is :)

    You can hook up to a dataBound event on the grid. here is more info on it 
    http://docs.kendoui.com/api/web/grid#events-dataBound

    Here is simple demo I made a  making use of such event.
    http://jsfiddle.net/92f5K/

    Hope this helps
  3. Kendo UI is VS 2017 Ready
  4. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 31 Oct 2013 Link to this post

    Hello nikobellic,

    I already know about the dataBound event.  As mentioned in the related post, the problem about this event is that it's fired after the data is received but before the grid gets filled with rows.

    Unfortunately, in those conditions, you can't rely on the actual dataBound event to select first row of the grid.

    Simon

  5. Answer
    Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 04 Nov 2013 Link to this post

    Hello Simon,

    The dataBound event is triggered after the rows are rendered. The dataBinding event is triggered before the rows are rendered.

    Regards,
    Daniel
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Simon
    Simon avatar
    159 posts
    Member since:
    Sep 2010

    Posted 25 Nov 2013 Link to this post

    Good news for me, you are right Daniel!

    Did something change about this event?  Maybe I'm wrong but I really thought the setTimeout solution proposed in this post was required when I asked the question the first time but obviously, this is not required anymore.
  7. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 27 Nov 2013 Link to this post

    Hello again,

    I am not sure why the timeout was needed. The rows should already be rendered in the dataBound event and this behavior has not been changed.

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