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

Client-side Binding and add_rowCreated()

4 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 2
Valery asked on 08 Mar 2010, 04:04 PM
Hi there,

I have the following a RadGrid bound to a Java script array. I am trying to subscribe to the RowCreated event using the add_rowCreated() method of the grid. Unfortunately the handler doesn't seem to be called at all although rows get created. Is it an intended behavior or a bug? And does it have anything to do with rows not being applied item styles as they are defined in the markup?

Thank you in advance,
Valery.

4 Answers, 1 is accepted

Sort by
0
Valery
Top achievements
Rank 2
answered on 10 Mar 2010, 07:41 PM
BTW, seems to be the same for add_dataBinding(...).
0
Rosen
Telerik team
answered on 11 Mar 2010, 09:54 AM
Valery,

As the rowCreated event is raised only when GridDataItem client-side object representation is constructed. Therefore it does matter when in page/grid client-side lifecycle you are attaching the handlers (the best place should be GridCreating event).

As to the dataBinding event, you should be aware that this event is raised only if automatic client-side databinding is used and not when control is populated manually.

Greetings,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
0
Valery
Top achievements
Rank 2
answered on 11 Mar 2010, 10:44 AM
Here is the scenario: the RadGrid is actually embedded in a script control and is initially empty. I subscribe some handlers to grid's events (like OnCommand, OnRowCreated, OnRowDataBound, OnDataBinding, OnDataBound, etc.) in the initialize() method of the control. After subscribing I call a web service method and handle its outcome. I then manually call the dataBind() method of the master table view.

At some point I realized that client-bound grids seem not to obey the ItemStyle property of the GridBoundColumn (e.g. NoWrap, CssClass and so...). So I apply these styling by myself currently in the OnRowDataBound event handler. However there is no need to so every time as these things don't change on rebind. It wouldn't bother me if the get_cell() call was not relatively time consuming. As far as I am rebinding the grid each second this turns out to be a bottleneck. Especially when you have more grids like this one.

So one of the possible solutions was to initialize these styles in the OnRowCreated event handler but it seems I can't subscribe for these events in the initialize method of Java script class accompanying my script control... And no "Too late to subscribe." Java script exception is thrown...

I can of course assign a flag to a new "alreadyFormatted" field of the row but it seems a bit dirty solution...

P.S. The OnDataBinding event handler issue was more an observation as I can always move the code before the call to the dataBind() method.
0
Accepted
Rosen
Telerik team
answered on 12 Mar 2010, 09:30 AM
Hello Valery,

Indeed I was able to observed the mentioned behavior - the rowCreated is not raised for extra items (above the pagesize+1).  However I'm happy to inform you that our developers has addressed it, thus the fix will be included in next internal build. I have updated your telerik points too.

Kind regards,
Rosen
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Valery
Top achievements
Rank 2
Answers by
Valery
Top achievements
Rank 2
Rosen
Telerik team
Share this question
or