点击网格项并更新文本字段时我没有遇到任何问题,但您认为我更改了标签文字吗? grrr
我想要做的就是当我在网格中选择一个记录集来更新标签文本和文本字段时(它已经这样做了)。
模型
Ext.define("myApp.model.ActionItem", {
extend : "Ext.data.Model",
fields : [
{
name: 'pri',
type: 'int'
},
{
name: 'request',
type: 'int'
}
]
});
控制器:
Ext.define("myApp.controller.HomeController", {
extend: "Ext.app.Controller",
id: "HomeController",
refs: [
{ ref: "ActionItemsGrid", selector: "[xtype=actionitemgrid]" },
{ ref: "DetailsPanel", selector: "[xtype=actionitemdetails]" }
],
pri: "",
models: ["ActionItem"],
stores: ["myActionStore"],
views:
[
"home.ActionItemDetailsPanel",
"home.ActionItemGrid",
"home.HomeScreen"
],
init: function () {
this.control({
"#homescreen": {
beforerender: this.loadActionItems
},
"ActionItemsGrid": {
itemclick: this.displayDetails
}
});
},
displayDetails: function (model, record) {
this.getDetailsPanel().loadRecord(record);
},
loadActionItems: function () {
var store = Ext.getStore("myActionStore");
store.load();
this.getActionItemsGrid().reconfigure(store);
}
});
查看
Ext.define("myApp.view.home.ActionItemDetailsPanel", {
extend : "Ext.form.Panel",
xtype: "actionitemdetails",
items: [
{
xtype: "fieldset", defaults: { xtype: "textfield", disabled: true },
items: [
{
xtype: 'label',
forId: 'pri',
text: 'My Priority',
margin: '0 0 0 10'
},
{ id: "pri", fieldLabel: "Priority" },
{ id: "request", fieldLabel: "Requested Time" }
]
}
]
});
答案 0 :(得分:0)
我刚刚从Condor找到了解决方案。 http://www.sencha.com/forum/showthread.php?106256-Form-Panel-Load-Record-and-show-the-data-in-form-label
它的要点是标签不是字段。所以为了做我想做的事,我需要一个xtype:' displayfield'用我想要的字段的名称。
{
xtype: 'displayfield',
name: 'pri',
text: 'My Priority',
margin: '0 0 0 10'
}