1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    154
    Vote Rating
    0
    NotChris is on a distinguished road

      0  

    Default Combobox migration

    Combobox migration


    We had been heavily using the methods to get and set the Displayfield for comboboxes in 2.1. What can be used to replace this functionality in 3.0 since we are currently converting our application to 3.0?

    Thank you.

  2. #2
    Ext GWT Premium Member
    Join Date
    Oct 2008
    Posts
    72
    Vote Rating
    5
    elirov is on a distinguished road

      0  

    Default


    The only way I could figure out how to do this was to assign a custom PropertyEditor. It's a pain though, because you need to override the parse method as well as the display method. There really should be something like a:

    getPropertyEditor().setDisplayField(..) method

  3. #3
    Sencha User
    Join Date
    Jan 2008
    Posts
    154
    Vote Rating
    0
    NotChris is on a distinguished road

      0  

    Default


    Thanks for the reply. Sencha, is there some reason this method was removed from 3.0?

    Thank you.

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,734
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    GXT 2 relies heavily on a sort of psuedo-reflection offered by the interface BaseModel that all model objects use anywhere had to implement. By requiring this, the relatively new RequestFactory and AutoBean features in GWT cannot be used by GXT data components, as you can't just add new method to the interfaces to be created by GWT.

    Instead, GXT 3 allows properties to be retrieved and modified generically using the ValueProvider interface. Two main methods exist here - how to set the value of a given object, and how to get the value of a given object. Simple instances where you are just reading or writing the same value over and over can be generated automatically using the PropertyAccess interface. LabelProvider is another such interface - its getLabel method takes a single object and returns a string based on that.

    You can build this functionality for your own use case with a LabelProvider that can be instructed to change how it works. ComboBoxCell doesn't allow the LabelProvider instance to be changed because it may have been used in the creation of the listview, and the user may or may not want that to be changed as well.

    So the method can't exist as-is in GXT 3, but you can get the same customizability by implementing your own LabelProvider, and manipulating its logic to decide which property to show and how.

Thread Participants: 2