0

I am working on a display where I need to bind a combobox but I am unable to pass parameters. Below is my code please provide me the way to pass parameters.

//store
Ext.define('NetworkStore', {
    extend: 'Ext.data.Store',
    alias: 'NetworkStore',
    fields: ['Id', 'value'],
    storeId: 'NetworkStore', 
    autoLoad: true,
    proxy: {
        type: 'ajax',
        useDefaultXhrHeader: false,
        actionMethods: { create: "POST", read: "GET", update: "POST", destroy: "POST" },
        headers: { 'Content-Type': 'application/x-www-form-urlencode' },
        limitParam: false,
        startParam: false,
        pageParam: false,
        extraParams: {
            Style: 1
        },
        url: 'url',
        reader: {
            type: 'json'
        }
    }
});

xtype: 'combo',
name: 'NetworkIDList',
store: {
        type: 'NetworkStore',
        'Style': 3 //parameter
        //params: {  // tried this way as well but did not work for me.
        //  Style: 3
        //}
        }

Note: Store is defined in a separate file.

2
  • Could you explain what you are trying to achieve? Why do you want to bind what? Commented Dec 18, 2019 at 17:45
  • I want to bind combobox with updated store, for that I need to call store with parameters, and I am unable to find the way to pass parameter for API call. Commented Dec 20, 2019 at 15:38

2 Answers 2

1

The store should be passed like below format.

store: {
        type: 'NetworkStore',
        proxy: {
                extraParams: {
                    Style: 3
                }
            }
        }
Sign up to request clarification or add additional context in comments.

Comments

0

You can change the params as follows:

let store = Ext.data.StoreManager.lookup('NetworkStore'),

    // params are part of the proxy, not the store
    proxy = store.getProxy(),

    // make sure you keep the other params
    newParams = Ext.apply(proxy.getExtraParams(), {style: '3'});

// set the params to the proxy    
proxy.setExtraParams(newParams);

// do whatever you plan to do with the store
store.load();

If you want to bind a value to store proxy params, take a look at this fiddle.

2 Comments

I want to bind it to combobox directly, where we define its store property.
Did you take a look at the fiddle. In the fiddle I show how to bind the extraParam property (style) to the store. You can do the same with your combobox value. If you do not know how to bind the combobox value, Please write so.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.