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

Setting the cursor position and selecting to new record in GridGroupin

Hi: I have problems when I add a new record in a GridGroupingControl working with collections. I would like to set the cursor and select the new added record. Using groupingGrid.TableControl.CurrentCell.MoveTo(this.regViticolaGridGroupingControl.TableControl.Model.RowCount ,1) cursor changes to the last line, but it is not selected. How can do it? Is there a way to do it with a grouped grid?

4 Replies

AD Administrator Syncfusion Team March 2, 2005 05:43 PM UTC

If you set the ListBoxSelectionMode in 3.0.1.0 as here, this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None; this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One; And then use this code to move the currentcell, it the currentrecord gets selected for me. gridGroupingControl1.TableControl.CurrentCell.MoveTo(this.gridGroupingControl1.TableControl.Model.RowCount ,1); gridGroupingControl1.Table.SelectedRecords.Clear(); gridGroupingControl1.Table.SelectedRecords.Add(gridGroupingControl1.Table.CurrentRecord);


JE Jose Egea March 2, 2005 06:44 PM UTC

That''s ok if my grid is not grouped by any column. And how can do the same if the grid is grouped by columns? Regards


AD Administrator Syncfusion Team March 2, 2005 08:11 PM UTC

This is likely a bug. I will forward it to Stefan so we can try to address it in our code. Until then, I think you can handle TableControlCurrentCellMoved and seelct the currentrecord there. private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e) { gridGroupingControl1.Table.SelectedRecords.Clear(); gridGroupingControl1.Table.SelectedRecords.Add(gridGroupingControl1.Table.CurrentRecord); }


JE Jose Egea March 3, 2005 08:44 AM UTC

Hi: Finally I have done this way: if (gridgrouping.TableDescriptor.GroupedColumns.Count==0) { gridgrouping.TableControl.CurrentCell.MoveTo(this.gridgrouping.TableControl.Model.RowCount ,1); gridgrouping.Table.SelectedRecords.Clear(); gridgrouping.Table.SelectedRecords.Add(gridgrouping.Table.CurrentRecord); } I don''t like it very much because when I add a new record and the grid is grouped by any column it''s still pointing to the previous row, not the new one. But it''s the only way I see to avoid an exception. Any suggestion?

Loader.
Up arrow icon