Extjs4 two ComboBox data sources are linked to solve the problem of displaying busy status after the second ComboBox

Source: Internet
Author: User

The definition is as follows [the red part is appended, which is the key to solving the problem ]:

VaR bu_store = ext. Create ('ext. Data. store ',{
Fields: ['key', 'value'],
Remotesort: True, // whether to sort data on the server
Proxy :{
Type: 'ajax ', // obtain data asynchronously. The URL here can be changed to any dynamic page, as long as JSON data is returned.
URL: 'soc/getbu ',
Reader :{
Root: 'items'
},

Simplesortmode: True
}
});
VaR evt_bu = new Ext. Form. ComboBox ({
ID: 'evt _ Bu ',
Fieldlabel: 'bus ',
Width: 240,
Store: bu_store,
Displayfield: 'value ',
Valuefield: 'key ',
Triggeraction: 'all ',
Emptytext: 'select ...',
Allowblank: false,
Blanktext: 'select Bu ',
Editable: false,
Mode: 'local', // This attribute is compatible with IE8 in the following ways
Listeners :{
'Render': function (){
Bu_store.load ();
}
}
});

VaR pdl_store = ext. Create ('ext. Data. store ',{
Fields: ['key', 'value'],
Remotesort: True, // whether to sort data on the server
Autoload: false,
Proxy :{
Type: 'ajax ', // obtain data asynchronously. The URL here can be changed to any dynamic page, as long as JSON data is returned.
URL: 'soc/getpdl ',
Reader :{
Root: 'items'
},

Simplesortmode: True
}
});

Pdl_store.on ("beforeload", function (){
Ext. Apply (pdl_store.proxy.extraparams, {'Bu ': evt_bu.getvalue ()});
});

VaR evt_pdl = new Ext. Form. ComboBox ({
Fieldlabel: '& nbsp; product line ',
Width: 240,
Store: pdl_store,
Listconfig: {loadmask: false },
Displayfield: 'value ',
Valuefield: 'key ',
Triggeraction: 'all ',
Emptytext: 'select ...',
Allowblank: false,
Blanktext: 'select product line ',
Editable: false
});

// Linkage implementation
Evt_bu.on ('select', function (){
Evt_pdl.clearvalue ();
Try {
Pdl_store.load ();
}
Catch (Ex ){
Ext. MessageBox. Alert ("error", "data loading failed. ");
}
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.