Results 1 to 2 of 2

Thread: Dynamically set valueFIeld/displayField in Ext.ux.form.MultiSelect

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    10

    Default Dynamically set valueFIeld/displayField in Ext.ux.form.MultiSelect

    I'm using Sencha Architect 4.2.8 and ExtJS framework 7.2.0. I've created a form which includes a MultiSelect and a few buttons. The intent is that when I instantiate this form it would be assigning a different store (with different field names) to the MultiSelect, allowing the same basic set of functions to work on multiple stores as needed without duplicating the interface for each store. In testing, when I assign valueFIeld and displayField to field names associated with the test store (which is assigned via setStore()) in Architect, the form works as intended. However, when I clear those fields in Architect and attempt to set them at runtime, it doesn't work. I set them before loading the store each time, and before calling show() on the parent window. I've tried setting them directly and with setConfig(), I've tried setting them in a beforeRender event, with and without setConfig(). There are no setDIsplayField or setValueField methods to use. I've looked online for examples of setting valueField and displayField dynamically, but I can only find examples using combobox, which doesn't help. So my question is, is there a way to dynamically set valueFIeld and displayField at runtime in Ext.ux.form.MultiSelect?
    Attached Images Attached Images

  2. #2
    Sencha User
    Join Date
    Oct 2012
    Posts
    10

    Default

    Quote Originally Posted by hcallesis View Post
    I'm using Sencha Architect 4.2.8 and ExtJS framework 7.2.0. I've created a form which includes a MultiSelect and a few buttons. The intent is that when I instantiate this form it would be assigning a different store (with different field names) to the MultiSelect, allowing the same basic set of functions to work on multiple stores as needed without duplicating the interface for each store. In testing, when I assign valueFIeld and displayField to field names associated with the test store (which is assigned via setStore()) in Architect, the form works as intended. However, when I clear those fields in Architect and attempt to set them at runtime, it doesn't work. I set them before loading the store each time, and before calling show() on the parent window. I've tried setting them directly and with setConfig(), I've tried setting them in a beforeRender event, with and without setConfig(). There are no setDIsplayField or setValueField methods to use. I've looked online for examples of setting valueField and displayField dynamically, but I can only find examples using combobox, which doesn't help. So my question is, is there a way to dynamically set valueFIeld and displayField at runtime in Ext.ux.form.MultiSelect?
    I figured out a way. I define a constructor for the window, and pass in a config object {valueField: 'x', displayField: 'y'}, Inside the constructor I parse the items list looking for reference = 'referencename' (a loop because lookup isn't configured yet), then call Ext.apply(list, config) and call the parent constructor (me.callParent(arguments). Kind of a roundabout solution but it works, I can set the value/display fields at the time I instantiate the window at runtime.

Tags for this Thread

Posting Permissions

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