Client-side Binding and add_rowCreated()

5 posts, 1 answers
  1. Valery
    Valery avatar
    45 posts
    Member since:
    Nov 2008

    Posted 08 Mar 2010 Link to this post

    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.
  2. Valery
    Valery avatar
    45 posts
    Member since:
    Nov 2008

    Posted 10 Mar 2010 Link to this post

    BTW, seems to be the same for add_dataBinding(...).
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 11 Mar 2010 Link to this post

    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.
  5. Valery
    Valery avatar
    45 posts
    Member since:
    Nov 2008

    Posted 11 Mar 2010 Link to this post

    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.
  6. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 12 Mar 2010 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017