View previous topic :: View next topic |
Author |
Message |
Shine
Joined: 04 May 2011 Posts: 3
|
Posted: Wed May 04, 2011 2:59 pm Post subject: CellEditor assigned to wrong nodes sometimes |
|
|
hi,
i use Version 3.14. The VirtualTree contains 3 Colums (MainColum, SubColumn and CellEditorColumn)
It shoult looks like that
MainColumn
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
MainColumn
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
MainColumn
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
At the beginning all MainColums are collapsed and no CellEditor is visible .. that is right .. MainColums do not neet a CellEditor. If you expand a MainColumn the SubColumn and the assigned CellEditor is displayed.
If you expand a MainColumn which contains a large amount of SubColumns (height of all these SubColumns is larger than control height) than the MainColums get a CellEditor.
It looks like this
MainColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
MainColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
MainColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
+ SubColumn [CellEditorColumn]
Code: |
protected override void OnGetCellData(Infralution.Controls.VirtualTree.Row row, Infralution.Controls.VirtualTree.Column column, Infralution.Controls.VirtualTree.CellData cellData)
{
base.OnGetCellData(row, column, cellData);
if (column == SubColumn &&
column.CellEditor != null)
{
column.CellEditor = new ComboBoxCellEditor();
}
} |
Any ideas to prevent the CellEditor on MainColumns?
regards
Shine |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed May 04, 2011 10:27 pm Post subject: |
|
|
If you could put together a example project that replicates the problem (perhaps by modifying one of the standard sample projects) that would help greatly understanding and tracking this issue down. You can email a zipped copy to support@infralution.com. _________________ Infralution Support |
|
Back to top |
|
|
Shine
Joined: 04 May 2011 Posts: 3
|
Posted: Thu May 05, 2011 7:18 pm Post subject: |
|
|
hi,
thanks for response .. project is on the way. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu May 05, 2011 11:46 pm Post subject: |
|
|
Thanks for the sample project - that makes it much easier to see what the issue is. The problem is that your code in OnGetCellData is setting the column.CellEditor. This sets the default CellEditor that the base OnGetCellData method uses for cells. Once you have set this then all cells will then get that CellEditor.
Instead you should be setting the CellData.Editor - this sets the CellEditor for just the cell. Here is the code that works:
Code: | private ComboBoxCellEditor _cellEditor = new ComboBoxCellEditor();
protected override void OnGetCellData(Infralution.Controls.VirtualTree.Row row, Infralution.Controls.VirtualTree.Column column, Infralution.Controls.VirtualTree.CellData cellData)
{
base.OnGetCellData(row, column, cellData);
if ((row.Item is SP.Adressen.AdressEigenschaftenManager.Eigenschaft))
{
if (column == this.m_ColumnWert)
{
cellData.Editor = _cellEditor;
}
}
} |
Note that you also had some redunant code in your OnGetCellData method that was checking if rows were visible and expanded etc. This is not required because OnGetCellData is only called when the row is visible. _________________ Infralution Support |
|
Back to top |
|
|
Shine
Joined: 04 May 2011 Posts: 3
|
Posted: Wed May 11, 2011 11:44 am Post subject: |
|
|
hi,
thanks for the correction .. it works. |
|
Back to top |
|
|
|