Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
Regarding assigning UltraDataSource to UltraGrid and Events
posted

Hi,

   I am handling a fairly complex application where in I am trying to do expand and collapse functionality for rows as well as columns. I have developed the functionality to expand / collapse the columns but I am yet to implement it for rows. The thing is, I have a hierarchical data in a flat 2d array. I do not want to use separate child bands to paint the hierarchy in the Ultra Grid. I just want to show (+/-) bitmaps in the Left most column on the LHS of the cell's TextUIElement. Since the parent child relationship is dynamic, I need a mechanism to include the clickable (+/-) images and different indentation for all the rows, based on the level in the hierarchy. Please let me know how can this be achieved. 

   Now the data part. I see that there are 2 different sets of events for a row objects for UltraDataSource and UltraGrid objects. For instance, InitializeDataRow and InitializeRow are two such events that deal with the corresponding datasource and grid objects. Similarly, InitializeRowCollection exists. What shall these event handlers implement as per the norms to take the advantage of subscribing to them. In other words, what is the difference between handling these event handlers and just creating a method of our own and calling it to populate the data source. There are another set of events for UltraDataSource viz. CellDataRequested, CellDataUpdating and CellDataUpdated. Do these methods work only in virtual mode when the LoadStyle is set to OnDemand? 

I have some doubts as to when to assign the datasource to the grid as depending on when the data binding is done, some of the events may be fired or not. For instance, if UltraDataSource is assigned in the beginning, then along with the events for InitializeDataRow and InitializeDataRowCollection, InitializeRow and InitializeRowCollection may be triggered. But if it is bound early, sometimes unwanted events also get fired. Ofcourse we have the option of adding and removing the handlers. But a better approach is what I seek. I am planning to do the operations on UltraDataSource and UltraGrid separately and then bind them as late as possible. 

Typically when shall I apply the styles / appearances, if I am using LoadOnDemand option? The problem is, I am having ValueBasedAppearances sort of situation. 

Thanks, 

Bhushan

Parents
  • 4625
    Verified Answer
    Offline posted

    Hi Bhushan,

    Thank you for posting in our forums!

    Based on your description, I believe that such functionality as collapsible rows could be accomplish via using the expanded property of the UltraGrid. For further information, take a look at the following documentation page: http://help.infragistics.com/Doc/WinForms/2010.3/CLR2.0/?page=Infragistics2.Win.UltraWinGrid.v10.3~Infragistics.Win.UltraWinGrid.UltraGridRow~Expanded.html

    The initialize sort of events give you the flexibility to choose on which particular state of initializing UltraGrid object you would like to add customized code that has the opportunity to change the default state of any UltraGrid component. However, there is a difference between InitializeDataRow and InitializeRow events. The first event is related to the underlying data’s initialization and the second event is related to the UltraGrid’s rows before being drawn. In the general case, all data sort of events are connected to the data source and all non-data events are related to the UltraGrid itself.

    Using the LoadOnDemand option, you could apply the appearance inside the InitializeRow event, that would allow you to set different appearance on each row before its being drawn, based on whatever condition you might think of.

    Please let me know if you have any additional questions.

Reply Children