我有一个关于从选定网格行获取数据的问题。
这是存储数据库信息的网格面板:
gridHoldingPanel = _ui.createGrid({
extClass: 'Ext.grid.Panel',
width: windowSettings.gridPanel.width,
height: windowSettings.gridPanel.height,
id: _id.archiveHistoryGrid,
title: null,
selModel: 'rowmodel',
store: ds,
columns: [{
header: 'Archived at',
dataIndex: 'archived_at',
width: 120
}, {
header: 'Calls Starting',
dataIndex: 'date_from',
width: 120
}, {
header: 'Calls Ending',
dataIndex: 'date_to',
width: 120
}, {
header: 'Calls Archived',
dataIndex: 'total_calls',
width: 90
}, {
header: 'Database',
dataIndex: 'db_archived',
width: 70
}, {
header: 'Archive Path',
dataIndex: 'path',
width: 200
}],
stripeRows: true,
listeners : {
itemdblclick: function(dv, record, item, index, e) {
var win = _restoreCallsWindow(), field= win.down('textfield');
field.setValue(record.get('path'));
win.show();
}
}
})
这是带有按钮的面板,它与网格位于同一窗口中:
buttonsPanel = _ui.createPanel({
border: false,
width: windowSettings.buttonsPanel.width,
height: windowSettings.buttonsPanel.height,
id: _id.archiveHistoryButtons,
items: [{
layout: 'hbox',
border: false,
margin: '5px 5px 5px 5px',
items: [
//Refresh button
_ui.createButton({
text: 'text_auto_refresh',
cls: 'sense-archive-button-buttons',
id: _id.arHistoryRefresh,
handler: function() {
ds.load();
}
}),
//Restore button
_ui.createButton({
text: 'text_restore',
margin: '0px 0px 0px 5px',
cls: 'sense-archive-button-buttons',
id: _id.arHistoryRestore,
handler: function(grid, rowIndex, colIndex) {
var row = gridHoldingPanel.getSelectionModel().getSelection();
console.log(row);
}
}),
//Close window button
_ui.createButton({
text: 'text_close',
margin: '0px 0px 0px 5px',
cls: 'sense-archive-button-buttons',
id: _id.arHistoryClose,
handler: function ( ) {
_historyWindow().close();
}
})]
}]
})
我想要做的是,当单击恢复按钮时,它会打开另一个包含文本输入字段的窗口,打开时我想显示数据网格中所选行的路径值。
正如您目前所看到的,我在恢复按钮中的代码将行值作为整个对象返回给我,当我尝试从对象中获取数据时record.data
返回给我undefined
。
有人可以帮我弄这个吗?