Results 1 to 2 of 2

Thread: ComboBox preselection from nested data structure

  1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    28

    Default ComboBox preselection from nested data structure

    Hello,

    I want to preselect a combobox with values from the currently selected row data in a grid.
    I am using a RowEditor with an overridden onRowClick method. Furthermore, I have a class called LanguageData and a class called UserData which both extend BaseModelData.
    The LanguageData is nested within the UserData in the form that UserData holds a language string in ISO format.
    The UserData is the ModelData for the grid. The user can fill in UserData values such as email, name and the language via the row editor. The language selection is represented by a combobox that is prefilled with store data of the type LanguageData. LanguageData also has an additional display text field for the language (so that f.e. not "en" is shown in the list but "English"). Setting the list of possible language values is no problem. When I enter values the first time and save them, I can also set the language value in the UseData correctly from the selected item in the combobox by getting the value from the value field of the combobox. But after saving the data and clicking the row again, the combobox has an empty value.

    How am I supposed to select the correct value in the combobox? Do I have to do some magic in the preProcessValue method of the used CellEditor? Or can I do something in the onRowClick of the RowEditor (however the row editor does not know which comboboxes have to be preselected)? Or is the desired behavior only possible via a different data model approach?

    Sorry that there is no source code here, because I am writing from home and do not have the code here but at work.

  2. #2
    Sencha User
    Join Date
    Apr 2011
    Posts
    28

    Default

    ok,

    so far, I am developing a solution. But I really thought, these kind of things were very common "problems" for which there is an elegant solution.

    My current solution is to involve the rowClick Event of the RowEditor. I register an additional handler for row clicks at my row editor class and when onRowClick is called also the handler callback is called (onRowClick was already overwritten). Since the handler resides on the client side, it knows which columns to adjust (in this case preselect the language combobox).

    It would be ideal if there was a derived class from combobox that does not only allow to set a store (by which the possible selection values are filled in). The class would also be able to set the associated store (in this case my user list). And when a row is selected from the associated store I tell the combobox which row and the selection is done by going through all items and compare them (a direct select is not possible since I cannot get a proper new instance by calling new M() where M is the Model ).

Similar Threads

  1. Nested JSON Structure in Gridpanel
    By BlueZealot in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 18 Apr 2011, 9:05 AM
  2. Possible to load nested component structure with template?
    By JohnJRyan in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 22 Sep 2010, 9:19 AM
  3. findById does not seem to work in heavily nested structure
    By karthik085 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 28 Jul 2010, 7:52 AM
  4. Accordion layout nested like a tree structure
    By hu97224 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 3 Feb 2010, 9:37 AM
  5. Preselection of Combobox Entry?
    By consolex in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 28 Sep 2009, 1:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •