Extjs从数据库获取Id并将其传递给组件
我面临的问题是。我有一个查询数据库和获取汽车信息的表单,我想获取数据的唯一Id,并将其传递给一个已经制作好的组件Extjs从数据库获取Id并将其传递给组件,extjs,extjs4,Extjs,Extjs4,我面临的问题是。我有一个查询数据库和获取汽车信息的表单,我想获取数据的唯一Id,并将其传递给一个已经制作好的组件 layout : 'fit', items : [{ xtype: 'cargrid', autoScroll: true //here I want the ID to be passed to this cone }] 也许,你想在网格上显示行的id吗 你需要把它放在商店/模型上。在数据存储上定义一个“id”字段 型号: fiel
layout : 'fit',
items : [{
xtype: 'cargrid',
autoScroll: true
//here I want the ID to be passed to this cone
}]
也许,你想在网格上显示行的id吗
fields: [
{name: 'idRow'},
{...}
]
columns: [{
header: "Identificator",
dataIndex: 'idRow'
},
{...}
]
var c = new Ext.panel.Panel({ //
height: 300,
renderTo: document.body,
layout: 'auto',
items: [
{
itemId: 'p1',
title: 'Panel 1',
height: 150
},
{
itemId: 'p2',
title: 'Panel 2',
height: 150
}
]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling
Ext.apply(c, {
itemId : 'p3'
}
fields: [
{name: 'idRow'},
{...}
]
columns: [{
header: "Identificator",
dataIndex: 'idRow'
},
{...}
]
var c = new Ext.panel.Panel({ //
height: 300,
renderTo: document.body,
layout: 'auto',
items: [
{
itemId: 'p1',
title: 'Panel 1',
height: 150
},
{
itemId: 'p2',
title: 'Panel 2',
height: 150
}
]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling
Ext.apply(c, {
itemId : 'p3'
}
编辑: 如果要覆盖de ID: 请参见以下链接: 并在注释中:(复制和粘贴) 示例:
fields: [
{name: 'idRow'},
{...}
]
columns: [{
header: "Identificator",
dataIndex: 'idRow'
},
{...}
]
var c = new Ext.panel.Panel({ //
height: 300,
renderTo: document.body,
layout: 'auto',
items: [
{
itemId: 'p1',
title: 'Panel 1',
height: 150
},
{
itemId: 'p2',
title: 'Panel 2',
height: 150
}
]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling
Ext.apply(c, {
itemId : 'p3'
}
评论:
fields: [
{name: 'idRow'},
{...}
]
columns: [{
header: "Identificator",
dataIndex: 'idRow'
},
{...}
]
var c = new Ext.panel.Panel({ //
height: 300,
renderTo: document.body,
layout: 'auto',
items: [
{
itemId: 'p1',
title: 'Panel 1',
height: 150
},
{
itemId: 'p2',
title: 'Panel 2',
height: 150
}
]
})
p1 = c.getComponent('p1'); // not the same as Ext.getCmp()
p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling
Ext.apply(c, {
itemId : 'p3'
}
一旦渲染组件Id,就无法更改它。可以在构件创建之前而不是创建之后指定 解决方法:
在呈现组件后不可能更改组件ID
谢谢那么基本上您需要包含数据的存储?你能解释清楚一点吗?告诉我们你试过什么。