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.
Unfortunately, activation email could not send to your email. Please try again.

Hierarchy with editable fields

Thread ID:

Created:

Updated:

Platform:

Replies:

39635 Jan 13,2006 07:30 AM Jan 17,2006 06:06 AM Windows Forms 4
loading
Tags: GridControl
Rohan
Asked On January 13, 2006 07:30 AM

As shown in the attached file, we have created an editable grid with first column as an hierarchy and rest of the columns as combo boxes. User can enter values in the combos. 1> Not able to assign text to the cell which has been selected from the combo box ( used of GridQueryCellInfo and e.style.celltype=”comboBox”). 2> I am able to create a tree structure in the grid using the "Virtual Tree Grid" example in Suncfusion samples It works fine the first time when all the parent nodes are populated in the grid, but when the "+" sign on the parent is clicked, rows should be inserted and the data for the children should be fetched. For inserting rows, i have written a code as Grid.Rows.InsertRange( 1, 1 ); but that doesnt work. Please give me a solution for working with a hierarchy in an editable grid.

EditGrid.zip

Administrator [Syncfusion]
Replied On January 16, 2006 05:30 AM

Hi Rohan, The VirtTreeGrid implementation can be done using a CollapsibleDataSource object. To use your own data, you would have to create and populate a CollapsibleDataSource.data using a code similar to that in CollapsibleDataSource.InitData method. Here is a sample which populates the CollapsibleDataSource.data with a data set. And I am also able to assign text to the ComboBox cells in the attached sample. Using the datatable.Rows.InsertAt function you can insert a row and then pass that to CollapsibleDataSource and call CollapseData. Here is a code snippet. DataRow dr = ds.Tables[1].NewRow(); dr[0] = "Inserted Row"; dr[1] = "My Child Name"; dr[2] = "12345"; ds.Tables[1].Rows.InsertAt(dr,8); externalData.InitFromDataSet(ds); gridControl1.ResetVolatileData(); externalData.CollapseData(); this.gridControl1.Refresh(); Regards, Calvin.

CS2.zip

Rohan
Replied On January 17, 2006 04:10 AM

Thank you Calvin. >Hi Rohan, > >The VirtTreeGrid implementation can be done using a CollapsibleDataSource object. To use your own data, you would have to create and populate a CollapsibleDataSource.data using a code similar to that in CollapsibleDataSource.InitData method. Here is a sample which populates the CollapsibleDataSource.data with a data set. >And I am also able to assign text to the ComboBox cells in the attached sample. >Using the datatable.Rows.InsertAt function you can insert a row and then pass that to CollapsibleDataSource and call CollapseData. Here is a code snippet. > >DataRow dr = ds.Tables[1].NewRow(); >dr[0] = "Inserted Row"; >dr[1] = "My Child Name"; >dr[2] = "12345"; >ds.Tables[1].Rows.InsertAt(dr,8); >externalData.InitFromDataSet(ds); >gridControl1.ResetVolatileData(); >externalData.CollapseData(); >this.gridControl1.Refresh(); > > >Regards, >Calvin.

CS2.zip

Rohan
Replied On January 17, 2006 04:18 AM

Calvin, Instead of using ComboBox Control for a cell I am using my own custom control. for this custom control its not assigning selected text to the cellText/cellValue and also its not firing a SaveCellInfo event. Can you explain why does it behave like this for a custom control? >Hi Rohan, > >The VirtTreeGrid implementation can be done using a CollapsibleDataSource object. To use your own data, you would have to create and populate a CollapsibleDataSource.data using a code similar to that in CollapsibleDataSource.InitData method. Here is a sample which populates the CollapsibleDataSource.data with a data set. >And I am also able to assign text to the ComboBox cells in the attached sample. >Using the datatable.Rows.InsertAt function you can insert a row and then pass that to CollapsibleDataSource and call CollapseData. Here is a code snippet. > >DataRow dr = ds.Tables[1].NewRow(); >dr[0] = "Inserted Row"; >dr[1] = "My Child Name"; >dr[2] = "12345"; >ds.Tables[1].Rows.InsertAt(dr,8); >externalData.InitFromDataSet(ds); >gridControl1.ResetVolatileData(); >externalData.CollapseData(); >this.gridControl1.Refresh(); > > >Regards, >Calvin.

CS2.zip

stanleyj [Syncfusion]
Replied On January 17, 2006 06:06 AM

Hi Rohan, The SaveCellInfo does not fire because this control is not designed interactive with the textbox of grid, Whereas the default cellType ComboBox is a combination of button and a ListBox. When the MS comboBox is embedded on the grid, the interaction is only on that control and not on grid. The other way of doing is to go for a custom cell type. You may either derive ComboBoxCellModel and ComboBoxCellRenderer or design from deriving GridDropDownCellModel and GridDropDownCellRenderer. If you have the source then you may refer code from Essential Suite\Windows\Grid.Windows\Src\Base\DropDown\GridComboBoxCellRenderer.cs and Essential Suite\Windows\Grid.Windows\Src\Extensions\CellTypes\GridDropDownGridListControlCellRenderer.cs to create similar celltype. ListBox is used for the dropdown and button is derived from GridCellButton (GridCellComboBoxButton.cs) and comboBox is not directly implemented. After creating the custom celltype, it has to be registered through CellModels.Add function and then this cell type can be implemented. Couple of samples can also be referred, that shows how SaveCellInfo is raised. 1. Syncfusion\Essential Studio\4.1.0.10\windows\Grid.Windows\Samples\CellTypes\CalendarCells(also available in earlier versions). The saveCellInfo is raised as the value of calendar is pushed to the CellValue of the grid in the OnSaveChanges function. 2. Refer this KB and see the onSaveChanges. Let me know if you have any more questions. Best regards, Stanley

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;