Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Elegant Grid Tech Support » Cell editing Collapse All
Subject Author Date
Dennis Mwape Oct 10, 2006 - 7:46 AM

I yesterday downloaded the elegant grid,to say the least am actually impressed.I am building a human resource application and on the first use i managed to bind my custom business collection objects to the elegant grid.However i want to enable the edititng of the objects properties in the grid.First i am failing to get the cell object for which you are saying has the startedit method.Please assist me on how to enable editing secondly I would want to add child object on the grid.your grid seems to limit the number of rows to the number of child objects.Third is on the use of the combobox cellstyle.I would want to bind certain data from which the user can select.Are they any ariticles I can access?

Technical Support Oct 10, 2006 - 10:32 AM

Thanks for the kind words.

If using the bound grid control, you should keep in mind that this control is mainly data-driven and cell instances are created only for visible cells. If you want to control cells manually and work with the grid in terms of cells and rows, you should consider using the unbound grid control.

To start editing a cell in the bound grid control, first make it visible in the view:

// Set desired data source item
boundGridControl1.FocusedDataSourceItem = dataset11.Table1[3]; 
// Set desired grid column
boundGridControl1.FocusedCellColumn = Column2Column; 
boundGridControl1.EnsureVisibleVertically(boundGridControl1.FocusedRowIndex);
boundGridControl1.FocusedCell.StartEdit();
We are aware that this approach may be a little obscure and that is why the next release (which is scheduled for the middle of September) will introduce a new task-oriented method StartCellEditByDataSourceItem.

The question about adding child objects is not completely clear. Would you provide more details?

The combo box cell content is controlled by the following proerties: MappingDataSource, MappingValueDataMember and MappingDisplayDataMember. You can set these properties at the column level and at the cell level. Here is a piece of code illustrating this:
public class MyClass
{
       public string MyProperty
{
              get
{
                    //..
}
}
}

//..

private MyClass[]  MyComboChoices;


//..

myComboColumn1.MappingDataSource = MyComboChoices;
myComboColumn1.MappingDisplayDataMember = "MyProperty";
myComboColumn1.MappingValueDataMember = "MyProperty";
In the above code, MyComboChoices is a container with combo box item objects. The two strings are names of display and value property names of objects in this container. If this container is a list of strings, integers or other simple types, you can use the special [-1] value for both property names.
At the moment you can set these values at the cell level only for the unbound grid, but we will provide this feature for the bound grid control in the upcoming release.