• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Combo Box reload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combo Box reload

    I have several combo boxes defined on my grid toolbar. These are loaded when the application starts and the first time the combo box is selected. After that, the combo box does not reload.

    Because the data in the grid is created by a background database application, I need the combo boxes to reload each time they are selected.

    Here is the properties of one of my combo boxes:

    Code:
                                    {
                                        xtype: 'combobox',
                                        itemId: 'company',
                                        width: 182,
                                        fieldLabel: 'Company',
                                        labelAlign: 'right',
                                        labelWidth: 80,
                                        value: '*ALL',
                                        displayField: 'COM_NBR',
                                        store: 'Companies',
                                        valueField: 'COM_NBR',
                                        listeners: {
                                            select: {
                                                fn: me.onComboboxSelect1,
                                                scope: me
                                            }
                                        }
                                    },

  • #2
    If you need combo store to reload every time you hit the arrow button then you could add 'onTriggerClick' function to achieve that. Something like:
    HTML Code:
    {
                                        xtype: 'combobox',
                                        itemId: 'company',
                                        width: 182,
                                        fieldLabel: 'Company',
                                        labelAlign: 'right',
                                        labelWidth: 80,
                                        value: '*ALL',
                                        displayField: 'COM_NBR',
                                        store: 'Companies',
                                        valueField: 'COM_NBR',
                                        onTriggerClick: function() {
                                             this.store.load();
                                             this.expand();
                                        },
                                        listeners: {
                                            select: {
                                                fn: me.onComboboxSelect1,
                                                scope: me
                                            }
                                        }
                                    },

    Comment


    • #3
      OK... i don't know how to do that. I tried to add a trigger function in Architect, but received a warning:
      "This function is overriding a parent function or config"

      Also, it added the function at the top (just under xtype:)... not sure if that is relevant or not.

      Comment


      • #4
        I tried to add that function, but recieved a warning: "This function is overriding a parent function or config"

        Architect placed the function just below the xtype:

        HTML Code:
        {
                                            xtype: 'combobox',
                                            onTriggerClick: function() {
                                                this.store.load();
                                                this.store.expand();
                                            },
                                            itemId: 'company',
                                            width: 182,
                                            fieldLabel: 'Company',
                                            labelAlign: 'right',
                                            labelWidth: 80,
                                            value: '*ALL',
                                            displayField: 'COM_NBR',
                                            store: 'Companies',
                                            valueField: 'COM_NBR',
                                            listeners: {
                                                select: {
                                                    fn: me.onComboboxSelect1,
                                                    scope: me
                                                }
                                            }
                                        },
        Obviously I'm doing something wrong.

        Comment


        • #5
          Placement of the code is a non-issue. And yes that warning is correct but that shouldn't prevent you to save the changes. Try saving the changes and see if that works as you expected.

          Comment


          • #6
            Originally posted by nsama View Post
            Placement of the code is a non-issue. And yes that warning is correct but that shouldn't prevent you to save the changes. Try saving the changes and see if that works as you expected.
            I did... the drop-down no longer functions at all.

            Comment


            • #7
              I see an error in the code you posted before, 'this.store.expand()' needs to be 'this.expand()'. If that doesn't fix, post the errors if you see any in the console. You can see the console errors when you hit f12 and click on console tab on the developer tools section on the bowser's bottom part.

              Comment


              • #8
                Thanks!

                It works great (now that I've entered the code right)

                Comment

                Working...
                X