I'm having a problem with the Infragistics 2008 UltraWinGrid that I'm hoping someone can help me with. I have a data source that has several rows each of which can have several child rows. When the data is loaded only the first level of rows are present. When a user clicks on the expand button a web service call is made which updates the data source to include the child rows of the expanded row. Here is the problem I am having:
Take the given table which has CellClickAction set to RowSelect:
- Parent Row 1 Child Row a Child Row b Child Row c+ Parent Row 2+ Parent Row 3
The first parent row has been expanded and the data for the 3 child rows have been read in from a web service. The second and third parent rows have not been expanded so they don't currently have any child rows, however if a user expands them they will each have 3 child rows read in from the web service.
Steps to reproduce:1.) Select Parent Row 1 with the mouse.2.) Hit the right arrow on the keyboard to move the selection to Child Row a.3.) Hit the down arrow on the keyboard twice to move the selection to Child Row c.4.) Hit the down arrow again and note that nothing happens since Parent Row 2 and Parent Row 3 has not loaded their children yet.5.) Click on the expand button next to Parent Row 2 and note that the expand button disapears and the row doesn't expand.6.) Select Parent Row 2 with the mouse and note that the row will now expand.
The row should expand as soon as the expand button is clicked, however it doesn't expand until I select the row itself.
The data source is a custom class that implements ITypedList. Before a row is expanded the custom class is notified and it will read in the needed data and then call the Refresh method of the CurrencyManager for the grid.
Any help on this issue would be appreciated. Thanks.
This is where I get a little confused:
nwallace said:4.) Hit the down arrow again and note that nothing happens since Parent Row 2 and Parent Row 3 has not loaded their children yet.
When you say "nothing happens", what exactly do you mean. Doesn't the focus move down from Child Row c to Parent Row 2? The fact that Parent Row 2 doesn't have any child rows doesn't seem like it should have any effect on navigation from Child Row x to Parent Row 2.
nwallace said:5.) Click on the expand button next to Parent Row 2 and note that the expand button disapears and the row doesn't expand.
This appears to be the real bug here, but since I don't know what event(s) you are using to load your data or how your custom data source is working, I really can't begin to guess why it's happening.
If you want to load the grid data on-demand, there is a way to do this already in place that I know works. So you might be better off using that method, rather than re-inventing the wheel. The method I am referring to is to use the UltraDataSource as the grid's data source and handle events like CellDataRequested. There's a sample of this both in the grid samples explorer and under the UltraDataSource samples called the Million Rows sample.
When using the up and down arrows the default behaviour is to navigate between rows of the same level. When focus is on Child Row c of Parent Row 1 and you hit the down arrow the normal operation is to move the focus to Child Row a of Parent Row 2. Since Child Row a under Parent Row 2 has not been loaded yet the focus does not leave Child Row c of Parent Row 1 because it is the last row of the child level rows. This is expected behaviour. After you expand Parent Row 2 and you hit the down arrow while the focus is on Child Row c of Parent Row 1 then focus should move to Child Row a of Parent Row 2.
I've attached a sample visual studio 2008 project(GridExample.zip) to my original post that illustrates what I am seeing.
Okay, I see the problem with your sample. But I'm afraid I really don't have to resources to debug it here in a forum post. If you are certain this is a grid issue and not a problem with the data source or your code, then I recommend that you Submit an incident to Infragistics Developer Support so they can check this out. I suspect they might ask you to simplify your sample, though, to eliminiate the possibility that this is being caused by the data source you are using.
Have you tried this using the UltraDataSource in on-demand mode?
I looked into the UltraDataSource on-demand solution however it looks like it is only on-demand for cell data, not entire rows. You would have to know how many rows are going to be read in ahead of time which is not possible in my case.
However I have come up with a solution to my problem. One of the issues I ran into earlier was knowing when to make the web service call to get the child data. This call should only be made when the data is needed for display in the grid. At first I had simply implemented this into the get method of the property that returns the child data. However this property is called whenever a parent row gets focus so un needed web service calls were being made. I then decided to move the web service call into an expand method that would be called whenever the BeforeRowExpanded event is raised on the grid. This works fine until you use the down arrow which doesn't raise the BeforeRowExpanded event. The grid will attempt to move into the the next parents child rows and would see that there would be none. This then modifies the expand related state of the parent row which causes the issue I was seeing.
To work around this I added logic into the OnInitializeRowsCollection method that will call my expand method whenever a BelowRow action is being performed.
Thanks for your help.