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
635
Hierarchical data
posted

Hi,

 We have a problem when setting the datasource of the wingrid to a bindlinglist of hierarchical business objects. It seems that unless there is data in this binding list for ALL levels of the hierarchy then the grid seems to reset itself and shows ALL columns for that band irrespective of the setting s for the grid in regard to which columns to display. Is there any way around this issue ? Also, it causes us problems even if we want to do something simple like:-

 clear grid

    do some form input

refresh grid i.e. set datasource to bindinglist of business objects (hierarchical, 2 levels) 

 

If we clear the grid by setting the datasource to null or new bindinglist<business objects> then when we later refesh the grid we are presented with all columns being shown in the grid for the second level data. Is there a workaround for this?

It seems to be if at any point you set the datasource of the grid to a bindinglist that is empty or for which the first entry in the list doesn't contain data for all of the 'child' bands then you are stuffed ie. all columns are shown and you lose all formatting, value lists etc. Is this the case? 

 

Thanks

Jim

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Jim, 

    You are correct, this will not work. The grid get's the data structure of all levels of the the data when you bind the grid. It does this by asking the BindingManager for it. The BindingManager does this by using the current row in the data - this is usually the first row. So it will start with the first row, get it's child rows, then walk down to their child rows, etc. If any of the child collections have no rows, then the BindingManager will be unable to aquire the data structure, and there's no way the grid can get it. 

    If the BindingManager is unable to get a row at any particular level, it will try to add a row, and then cancel it once it's done. In order to do this, the objects must implement IEditableObject. So one way to get this to work would be to implement this interface.

    Another alternative might be to use UltraWinTree instead of UltraWinGrid. The tree lacks certain grid features like summaries and filtering. But if those are not important for your application, then the tree might be a good alternative, because the tree aquires the data structure on-demand as it needs to, rather than getting it all up front. 

Reply Children