ExtJS- combo& grid
2. Extjs4.0 設置 Ext.data.Store 傳參的請求方式
https://newgoodlooking.pixnet.net/blog/post/110333223
var Store = Ext.create('Ext.data.Store', {
pageSize: pageSize,
model: 'Ext.data.Model名稱',
autoLoad: false,
proxy: {
type: 'ajax',
url: '請求路徑',
getMethod: function(){ return 'POST'; },//亮點,設置請求方式,默認為GET
reader: {
type: 'json',
root: 'Data',
totalProperty: 'totalCount'
}
},
listeners: {
'beforeload': function (store, op, options) {
var params = {
//參數
};
Ext.apply(store.proxy.extraParams, params);
}
}
});
3.
預設的ExtJS 3.4版裡只有單純的下拉選單ComboBox的Form元件,假如要顯示的欄位數比較多時,像是顯示姓名、電話,選取後可以設值為使用者編號,就可以利用TriggerField來制作ComboGrid。
https://blog.yslifes.com/archives/1053
4.
如果不是‘额’,点击其他combo填入的值都和最后一次触发的相同。‘select’也可以实现(function 中传入的参数不同,combo, records, eOpts),可以获得combo,再获得值
Ext.getCmp('combobox的id')。然后getValue();
https://blog.csdn.net/Jay821/article/details/18088121
items : [{
xtype : 'combobox',
id : 'one',
name : 'one' ,
margin : '12px 4px 4px 4px',
fieldLabel : '一',
store : ['1', '2', '3', '非'],
listeners : {
change : {
fn : me.changeValue,
scope : me
}
}
}, {
xtype : 'combobox',
id : 'two',
name : 'two' ,
margin : '12px 4px 4px 4px',
fieldLabel : ' 二',
store : ['1', '2', '3', '额 '],
listeners : {
change : {
fn : me.changeValue,
scope : me
}
}
}, {
xtype : 'combobox',
id : 'three',
name : 'three',
margin : '12px 4px 4px 4px',
fieldLabel : ' 三',
store : ['1', '2', '3', '额 '],
listeners : {
change : {
fn : me.changeValue,
scope : me
}
}
}}]
changeValue : function(obj, newValue, oldValue, eOpts ) {
if (newValue != '额') {
var Mond = Ext.getCmp('one');
if (Mond.getValue() != '额') {
Mond.setValue(newValue);
}
var Tuesd = Ext.getCmp('two');
if (Tuesd.getValue() != '额') {
Tuesd.setValue(newValue);
}
var Wednesd = Ext.getCmp('three');
if (Wednesd.getValue() != '额') {
Wednesd.setValue(newValue);
}
}
}
VV5.Combo 連動
http://readily-notes.blogspot.com/2014/02/aspnet-mvc-4-webapi-extjs-combo.html
建立欄位
這裡與上面的 Ext.data.JsonStore 有關聯,為什麼不建立產品資料內容?就是要等選擇後再建立。
combobox 內有監看 ( listeners ) 事件,就等於 WebForm 的事件一樣,選擇後,先將產品下拉式選單清空,再將此資料下
的 Product 資料放進去。
[
{
xtype: 'combobox',
fieldLabel: '類別',
name: 'Category',
//queryMode: 'local',
store: storeCategory,
editable:false,
valueField: 'CategoryID',
displayField: 'CategoryName',
listeners: {
select: function (combo, record, index) {
// raw 取得選取的資料
var tempProducts = record[0].raw.Products;
// 清空 product combobox 的store
storeProduct.removeAll();
for (var i = 0; i < tempProducts.length; i++) {
// 加到 product combobox 的store
storeProduct.add(tempProducts[i]);
}
}
}
},
{
xtype: 'combobox',
fieldLabel: '產品',
queryMode: 'local',
name: 'Product',
editable: false,
store: storeProduct,
valueField: 'ProductID',
displayField: 'ProductName',
}
]
留言
張貼留言