Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Implementing the UltraNumericEditor to handle a custom object
posted

What I am trying to accomplish is provide specific edit capabilities for the editable cells.  The problem that I'm running into is that the value of the column (because of the Data Table definition) is a custom object.  I've overriden the ToString() method of the custom object to provide the display in each cell, but when I try to use an editor I get this error: Editor provided by UltraNumericEditor does not support the column's data type.

Is there a way to create a custom NumericEditor to accept my custom object as a valid input?

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    The grid can't know how to translate a string that the user enters into your custom object. So there's no way the grid can handle this automatically.

    But you can implement this conversion yourself using a DataFilter.

    What you do is create a class that implements IEditorDataFilter. The interface has only one method, and you just need to handle the DisplayToEditor and EditorToDisplay conversions. For DisplayToEditor, you take the string the user typed and create a new instance of your custom class based on that string. For EditorToDisplay, you take the custom object and return a string.

    I think you might also need to set conversionArgs.Editor.ExpectedType to the type of your custom object, but I'm not 100% sure about that.

Children
No Data