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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TableModel of child table

Thread ID:

Created:

Updated:

Platform:

Replies:

74685 Jun 24,2008 10:50 PM UTC Jun 26,2008 02:26 PM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 24, 2008 10:50 PM UTC

Hi,
Is there any way to access the tablemodel of a child table in a grid grouping control?

I can access the child table using:
ChildTable itemAttribTable = gridGroupingControl1.Table.Records[0].NestedTables[0].ChildTable;

But the child table doesn't seem to have a table model.

Thanks


Administrator [Syncfusion]
Replied On June 24, 2008 11:08 PM UTC

Try this code to see if this gives you what you want:

ChildTable itemAttribTable = gridGroupingControl1.Table.Records[0].NestedTables[0].ChildTable;
GridTableModel model = gridGroupingControl1.GetTableModel(itemAttribTable.Name);



Administrator [Syncfusion]
Replied On June 25, 2008 04:46 PM UTC



>Try this code to see if this gives you what you want:

ChildTable itemAttribTable = gridGroupingControl1.Table.Records[0].NestedTables[0].ChildTable;
GridTableModel model = gridGroupingControl1.GetTableModel(itemAttribTable.Name);




Thanks for the reply,

The code gives me the tableModel, but it seems to contain rows for the entire table, not just the rows in the table grouped under the child table for that record.

Is there any way to get a tableModel that only contains rows for the child table of a specific record? (the rows displayed grouped under the record)

What I'm really trying to do is find a way to index straight to the cell properties of a cell in a child table (cellStyle, text, dropdown datasource) outside of an event.


Administrator [Syncfusion]
Replied On June 26, 2008 02:26 PM UTC

If you know the gridrecord and fieldname of a cell in a grid with nested tables, then you can get the style using code like:

private GridTableCellStyleInfo GetStyleFromRecordColumn(GridRecord record, string column)
{
GridTableCellStyleInfo style = null;

GridTable table = (GridTable)record.ParentTable;
if (table != null)
{
GridTableDescriptor td = table.TableDescriptor;
GridTable childTable = table;// gridGroupingControl1.GetTable(name);

//now get the proper row index wrt to nested tables
ChildTable ct = table.FilteredChildTable; //save the childtable
//get the correct column index wrt nested tables
int field = td.NameToField(column);
int colIndex = td.FieldToColIndex(field);

table.FilteredChildTable = record.ParentChildTable;
int rowIndex = table.DisplayElements.IndexOf(record); //look up index in the right table
style = table.GetTableCellStyle(rowIndex, colIndex);
table.FilteredChildTable = ct; //reset the childtable
}

return style;
}



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.

Warning Icon 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.Close Icon

;