We've got a RowLoaded event! Could we get a RowLoading event?

5 posts, 0 answers
  1. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 25 Jun 2010 Link to this post

    I have a custom control that I need to bypass UI event raising because of the interaction of a tree state IsComplete and CompletionDate property.

    If I had a RowLoading event that occurs before binding I could disable the firing of events during be row creation process and restore the event firing in the RowLoaded event.

    Of course, other suggestions are always welcome!  
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 29 Jun 2010 Link to this post

    Hi John Thompson,

    Could you please show us some code that will help us better understand your scenario ans requirements.


    Sincerely yours,
    Milan
    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
  3. DevCraft banner
  4. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 29 Jun 2010 Link to this post

    How about something like this:

            private void gridMatter_RowLoading(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) 
            { 
                CheckListItem item = e.DataElement as CheckListItem; 
     
                if (item == null) 
                { 
                    return; 
                } 
     
                item.CanFireEvents = false
            } 
     
            private void gridMatter_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e) 
            { 
                CheckListItem item = e.DataElement as CheckListItem; 
     
                if (item == null) 
                { 
                    return; 
                } 
     
                item.CanFireEvents = true
                }        

    Since the CheckListItem object has properties that are bound to the UI and also interact with each other this would allow me to detect the initializing of the UI elements and avoid firing events that have side effects.

    Does this help?
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 30 Jun 2010 Link to this post

    Hi John Thompson,

    Since the event handling is controlled by the data you can use our DataLoading event:

    void clubsGrid_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
    {
        foreach (CheckListItem item in (e.ItemsSource as Ilist<CheckListItem>))
        {
            item.CanFireEvents = false
        }
    }
      
    void clubsGrid_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
    {
        // enable fireing
    }


    Regards,
    Milan
    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
  6. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 30 Jun 2010 Link to this post

    I thought so, too.  However the Dataloading and DataLoaded are all done before the binding begins.since the data load mode is set to asynchronous and the scroll mode is deffered.

    There is quite a bit of data in the grid but I will change the DataLoadMode and the ScrollMode to see how this affects performance.
Back to Top
DevCraft banner