We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

DropDown Virtual Grid

HI, I've been working on making a DropDown Grid in a Virtual grid, with the DropDown grid too bound to a Data Store. I've worked ahead on one of your samples. So far its working but there are a few quirks which I need smoothened out. I have a Parent Grid with 5 colums and 1 row initially. rows are added dynamically. The second Column has its style set to DropDownGrid. I've bound the drop down grid using the same technique demonstrated by your sample. THe problem is such. Suppose I am at row 1 and I add data to a Child grid, say 4 rows of data and shift to a new parent row. Now when I bring up the dropdown grid of the second row it shows 4 rows instead of one. Can you tell me an efficient method of refreshing the child grid (there is only one instance of the child grid. I am binding it to a new datasource, every time the row changes). If there was a RowColChange event as in the good ol' MS FlexGrid, I could rebind the child data on this event and refresh the child grid. Please suggest a working alternative. I should be able to rebind the child grid and refresh it on row change of parent grid. Any help will be highly appreciated. Thanks Sumit.

6 Replies

AD Administrator Syncfusion Team May 8, 2003 01:55 PM UTC

Sumit, You have code like iRowNumber = e.RowIndex; in GridCellClicked. This suggests that iRowNumber should be 1-based as the first row is 1. But this value is used in your datasource an an index of the array which makes it want to be zero based. To get things to run, in your GetChildGrid method, I added a -1 so you can pass in the row number. return objChildGrids[rowIndex-1] as CGridData; But doing this made the first value of iRowNumber wrong as it was initially zero. So, in FormLoad I set iRowNumber = 1 to sync it up to the first row. With those changes your code seems to run. To control the height of the dropdown, catch the CurrentCellShowingDropDown event, and set e.Size to whatever values you want.


SU Sumit May 9, 2003 01:25 AM UTC

Hello Clay, Thank you for the changes suggested. I've incorporated them. but I still have a few quirks to smoothen out. Probably you can duplicate them if you follow these steps. 1. Put some Data in first column of first row. (This will add a new blank row.) 2. Bringup the Child Grid of the first row. Now the child grid has only One blank row. Add some data in any of the cells and on enter you'll get a new row. Add some data to the second row too. You'll end with with two datarows and one blank row. 3. Now go to the first column of the second Parent Row. Type some data. Bringup the child grid of the second row. You'll see 3 blank rows instead of one. Now enter data in the first row and then the grid refreshes back to 2 rows. THIS IS the behaviour I want to avoid. I want the Child grid to show the correct number of rows. Its hapenning because the binding is taking place ONLY at the CellQueryInfo event. Before that the Grid is having characteristics of the previous datasource it was bound to. I want a proper event where I can set the correct number of rows and columns of the child grid for the current row. Another glitch is that if I click on the dropdown button of another row while a child is being displayed, the new child shows data of the previous row itself. Again this is because of incorrect refreshing. I hope I've made my problem slightly clearer this time. Thanks once again, Sumit.


AD Administrator Syncfusion Team May 9, 2003 07:31 AM UTC

At the bottom of the OnInitialize override in the dropdown renderer, try adding this.grid.Model.ResetVolatileData();


SU Sumit May 10, 2003 06:05 AM UTC

Thank you, your solution worked. One final query. Is there an event that is fired on row/col change. Change maybe due to keypress or mouseclick!!! I am currently handling only the click. Thanks for the great support you are providing, Sumit.


AD Administrator Syncfusion Team May 10, 2003 02:15 PM UTC

There is a CurrentCellMoving that fires before the move and a CurrentCellMoved that fires after the move. There are other CurretnCellXXXXXX events that fire as a cell deactivates and another cell activates.


JJ Jim Jenkins June 29, 2003 04:52 PM UTC

Hello Sumit: I have a very similar need but do not wish to save any data back to the datasource but need a dropdown grid that displays a lot of information to the user. Would you consider posting your finished sample for others to use as a reference? Jim > HI, > > I've been working on making a DropDown Grid in a Virtual grid, with the DropDown grid too bound to a Data Store. I've worked ahead on one of your samples. > > So far its working but there are a few quirks which I need smoothened out. > I have a Parent Grid with 5 colums and 1 row initially. rows are added dynamically. The second Column has its style set to DropDownGrid. I've bound the drop down grid using the same technique demonstrated by your sample. > > THe problem is such. Suppose I am at row 1 and I add data to a Child grid, say 4 rows of data and shift to a new parent row. Now when I bring up the dropdown grid of the second row it shows 4 rows instead of one. > > Can you tell me an efficient method of refreshing the child grid (there is only one instance of the child grid. I am binding it to a new datasource, every time the row changes). > > If there was a RowColChange event as in the good ol' MS FlexGrid, I could rebind the child data on this event and refresh the child grid. Please suggest a working alternative. I should be able to rebind the child grid and refresh it on row change of parent grid. > > Any help will be highly appreciated. > > Thanks > Sumit.

Loader.
Live Chat Icon For mobile
Up arrow icon