项目 单击网格。更改标签文本

Item Click grid. Change label text

我在单击网格项和更新文本字段时没有问题,但你认为我会更改标签文本吗?咕噜

当我 select 网格中的记录集时,我只想更新标签文本和文本字段(它已经这样做了)。

型号

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" }
                    ]
                }
            ]
});

我刚才从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'
}