0
A
回答
1
您可以在treepanel上放置'itemdblclick'事件的偵聽器,以便從項目的被雙擊的原始屬性中獲取數據。然後,通過引用底層網格的商店,只需使用商店的「loadRawData」方法追加該數據對象即可。以下是基於Sencha網站示例的代碼示例:
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: "School Friends", expanded: true, children: [
{ text: "Mike", leaf: true, name: "Mike", email: "[email protected]", phone: "345-2222"},
{ text: "Laura", leaf: true, name: "Laura", email: "[email protected]", phone: "345-3333"}
] },
{ text: "Facebook Friend", expanded: true, children: [
{ text: "Steve", leaf: true, name: "Steve", email: "[email protected]", phone: "345-2222"},
{ text: "Lisa", leaf: true, name: "Lisa", email: "[email protected]", phone: "345-3333"}
] },
]
}
});
Ext.create('Ext.tree.Panel', {
title: 'All My Friends',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody(),
listeners : {
itemdblclick : function(tree, record, index){
Ext.getStore('simpsonsStore').loadRawData([record.raw], true);
}
}
});
Ext.create('Ext.data.Store', {
storeId:'simpsonsStore',
fields:['name', 'email', 'phone'],
data:{'items':[
{ 'name': 'Bart', "email":"[email protected]", "phone":"555-222-1234" },
{ 'name': 'Homer', "email":"[email protected]", "phone":"555-222-1244" },
{ 'name': 'Marge', "email":"[email protected]", "phone":"555-222-1254" }
]},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items'
}
}
});
Ext.create('Ext.grid.Panel', {
title: 'Best Friends',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [
{ text: 'Name', dataIndex: 'name' },
{ text: 'Email', dataIndex: 'email', flex: 1 },
{ text: 'Phone', dataIndex: 'phone' }
],
height: 200,
width: 400,
renderTo: Ext.getBody()
});
相關問題
- 1. 在ExtJS網格項目上打開ExtJS桌面窗口雙擊
- 2. extjs網格面板
- 3. ExtJs雙擊網格行應該將項目移動到另一個網格
- 4. Ext.net MVC Razor Cell雙擊網格面板
- 5. 面板上的Extjs雙擊事件
- 6. 在ExtJs中添加按鈕到網格
- 7. 如何在表單面板中添加網格面板?
- 8. extjs:加載蒙板網格
- 9. 是否可以在網格面板中添加文本元素extjs 2
- 10. ExtJS添加面板到面板
- 11. 將幫助按鈕添加到Extjs網格面板標題
- 12. 添加行到Extjs網格面板,這是不可見的
- 13. Extjs爲手風琴內容添加網格面板
- 14. ExtJS添加面板上面已添加面板
- 15. 使用JsonStore的ExtJS 4面板網格不加載網格
- 16. 在網格內添加行extjs
- 17. ExtJs面板網格列在加載數據後消失
- 18. ExtJS - 在其他面板頂部添加浮動面板
- 19. 在網格上雙擊
- 20. ExtJS 4.0.7加載完成TreePanel
- 21. 的ExtJS TreePanel中:每
- 22. ExtJS的庫而不網址TreePanel中
- 23. 在wpf中動態添加面板到網格中
- 24. 在JSP中的kendo panelbar面板中動態添加kendo網格
- 25. ExtJS和簡單的網格面板
- 26. 切換列標題extjs網格面板
- 27. 帶複選框的Extjs網格面板
- 28. ExtJS。適合網格寬度到面板
- 29. 定製ExtJs樹網格面板
- 30. ExtJS面板不會加載裏面的網格內容
感謝您的快速響應。我會嘗試這個例子。 – sreekanth
這是工作,感謝您的幫助 – sreekanth