Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CellEditor assigned to wrong nodes sometimes

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Shine



Joined: 04 May 2011
Posts: 3

PostPosted: Wed May 04, 2011 2:59 pm    Post subject: CellEditor assigned to wrong nodes sometimes Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed May 04, 2011 10:27 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Shine



Joined: 04 May 2011
Posts: 3

PostPosted: Thu May 05, 2011 7:18 pm    Post subject: Reply with quote

hi,

thanks for response .. project is on the way.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu May 05, 2011 11:46 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Shine



Joined: 04 May 2011
Posts: 3

PostPosted: Wed May 11, 2011 11:44 am    Post subject: Reply with quote

hi,

thanks for the correction .. it works.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group