CellType with Subeditor

Posted by: stefanleitl on 8 September 2017, 2:52 pm EST

  • Posted 8 September 2017, 2:52 pm EST

    Hello,

    I need a CellType which handles following specifications.

    I have a class with some properties for a cell-value.

    The editor must be readonly. If the editor is going into editmode a modal dialog (like Subeditor) should be shown where my object can be edited.

    This dialog have a cancel button where the editing can be canceled without any changes in datamodel.

     

    How can I implement this. Which class must be the baseclass for my Celltype.

    Thanks

  • Replied 8 September 2017, 2:52 pm EST

    Hello,

    I really do not see the need of creating a custom CellType, all you need to do is to create a SubEditor of your own by implementing ISubEditor interface and assign it to any cell of type GeneralCellType or TextCellType. Later you could modify the values using the SubEditor and assign back that value to the cell, and you can set the ReadOnly property of the CellType to true so that the user can edit the cell only by using the subeditor. I have attached a sample that depicts the same, click on any cell in the first column, it would open up the SubEditor and you can edit the value of the cell. Kindly have a look at it, please let me know if I missed something.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur


    2012/02/subeditor.zip
  • Replied 8 September 2017, 2:52 pm EST

    Hello,

    Thanks that seems to work for me. But why is in the SetValue method a string is passed instead of the object (MyClass) which is the "real" cell-value.

    How I make it work that the object is passed. I won't use the Parse method.

     

    Thanks

  • Replied 8 September 2017, 2:52 pm EST

    Hello,

    I am not able to understand what value do you exactly want to assign to a cell using your own class. I would request you to elaborate your requirement so that I can help you further.

    Thanks,

    Manpreet Kaur

  • Replied 8 September 2017, 2:52 pm EST

    Hello,

    The value at the SheetDataModel for the cell is a instance of a class which has three properties of string. I would pass this instance of my class to the Subeditor and not the Cell-Text which comes from the ToString Method of the class.

    In other words. I think the text of the cell is passed to the Subeditor and not the value.
  • Replied 8 September 2017, 2:52 pm EST

    Hello,

    I would suggest you to create a sub editor with three textboxes, get an entry for each property of the object of your class in one textbox each as the property are of string types. Later, in the SetValue method of the SubEditor you could create an object of your class, assign the values to its properties using the input from the textbox. Once you have createda an object of your class you can assign it to the cell value, as the SetValue method sets the value of the cell which is of Object type, and the same is painted as the text in the cell. You can even refer to following threads which discuss similar kind of issues:

                                 http://www.clubfarpoint.com/Forums/forums/thread/13841.aspx

                                 http://www.clubfarpoint.com/Forums/forums/thread/10953.aspx

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels