[英]Get all Grid Panel Checkbox checked row
Ext.define('MyApp.view.MyPanel21233', {
extend: 'Ext.panel.Panel',
alias: 'widget.dailywindow',
header: false,
width: window.innerWidth,
height: window.innerHeight,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'container',
layout: {
align: 'stretch',
type: 'hbox'
},
items: [
{
xtype: 'gridpanel',
width: 200,
alias: 'widget.mydailychartgrid',
height: window.innerHeight - 100,
header: false,
store : VehicleStore_Chart,
title: 'My Grid Panel',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'Plat_No',
text: 'Plat No'
}
],
selModel: Ext.create('Ext.selection.CheckboxModel', {
checkOnly : true // for prevent clicked grid row and canceled all check box checked status
})
}//item
,win
]
}
]//item
,
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
height: 40,
items: [
{
xtype: 'datefield',
fieldLabel: 'Start',
labelWidth: 50,
format: 'Y-m-d',
value: new Date()
},
{
xtype: 'datefield',
fieldLabel: 'End',
labelWidth: 50,
format: 'Y-m-d',
value: new Date()
},
{
xtype: 'button',
text: 'Generate',
iconCls: 'OK',
height: 34,
width: 80,
listeners: {
'click': function(c){
GenerateButtonClick();
}
}
}
]
}
]
});
me.callParent(arguments);
}
});
如何在我的Plat_No
中檢查哪個Plat_No
?
var record = Ext.ComponentQuery.query('mydailychartgrid')[0].getSelectionModel().getSelection()
for (var j = 0; j < record.length; j++){
record.get('Plat_No');
}
哪里不對了? TypeError: Ext.ComponentQuery.query(...)[0] is undefined
錯誤TypeError: Ext.ComponentQuery.query(...)[0] is undefined
請檢查以下代碼。
Ext.define('MyApp.view.MyPanel21233', {
extend: 'Ext.panel.Panel',
alias: 'widget.dailywindow',
header: false,
width: window.innerWidth,
height: window.innerHeight,
initComponent: function() {
var me = this;
Ext.applyIf(me, {
items: [
{
xtype: 'container',
layout: {
align: 'stretch',
type: 'hbox'
},
items: [
{
xtype: 'gridpanel',
width: 200,
//alias: 'widget.mydailychartgrid',
name:'mydailychartgrid',
height: window.innerHeight - 100,
header: false,
store : VehicleStore_Chart,
title: 'My Grid Panel',
columns: [
{
xtype: 'gridcolumn',
dataIndex: 'Plat_No',
text: 'Plat No'
}
],
selModel: Ext.create('Ext.selection.CheckboxModel', {
checkOnly : true // for prevent clicked grid row and canceled all check box checked status
})
}//item
,win
]
}
]//item
,
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
height: 40,
items: [
{
xtype: 'datefield',
fieldLabel: 'Start',
labelWidth: 50,
format: 'Y-m-d',
value: new Date()
},
{
xtype: 'datefield',
fieldLabel: 'End',
labelWidth: 50,
format: 'Y-m-d',
value: new Date()
},
{
xtype: 'button',
text: 'Generate',
iconCls: 'OK',
height: 34,
width: 80,
listeners: {
'click': function(c){
GenerateButtonClick();
}
}
}
]
}
]
});
me.callParent(arguments);
}
});
代替“ alise”,定義“ name”屬性,然后執行以下代碼。
var record = Ext.ComponentQuery.query('dailywindow gridpanel[name=mydailychartgrid]')[0].getSelectionModel().getSelection();
正如它所暗示的,查詢沒有找到任何東西。 創建實例時,不能指定alias
。 您需要提供其他某種方式來查找組件(也許是itemId
)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.