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
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.
Mike,
Thanks for the quick reply on this. Unfortunately there is no way we can use a treeview as we've invested a large amout of time using the wingrid with hierarchical data. I do find it quite amazing that even though the structure of the data is freely available and doesn't change the grid itself 'overrides' the data structure with the data structure it thinks it 'might' be. Also, why don't we see the correct data wehn we show the data, clear the grid (empty bindinglist), then attach the same binding list with data. Is there any work being done at Infragistics to resolve this? We've experienced it for a long time, reported it on here (although at the time didn't knwo what th reason was). Everytime we get a new release we hope that the 'bug' has been fixed.
Regards