This is a migrated thread and some comments may be shown as answers.

DataBounded event

5 Answers 508 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 25 Oct 2013, 06:17 PM
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

5 Answers, 1 is accepted

Sort by
0
Ignacio
Top achievements
Rank 1
answered on 25 Oct 2013, 07:53 PM
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
0
Simon
Top achievements
Rank 1
answered on 31 Oct 2013, 11:03 PM
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

0
Accepted
Daniel
Telerik team
answered on 04 Nov 2013, 12:11 PM
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!
0
Simon
Top achievements
Rank 1
answered on 26 Nov 2013, 02:12 AM
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.
0
Daniel
Telerik team
answered on 27 Nov 2013, 03:33 PM
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!
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Ignacio
Top achievements
Rank 1
Simon
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or