0

我正在开发一个客户经理页面,该页面基本上使用显示字段显示人员对象(名字,姓氏......)的详细信息,无需任何编辑,我的视图小部件如下:

Players.panel.View = function(config) {
config = config || {};
Ext.apply(config,{
    border: false
    ,baseCls: 'modx-formpanel'
    ,url: Players.config.connectorUrl
    ,baseParams: { action: 'mgr/player/get' }
    ,items: [{
        html: '<h2>'+_('players.view.title')+'</h2>'
        ,border: false
        ,cls: 'modx-page-header'
    },{
        xtype: 'modx-tabs'
        ,bodyStyle: 'padding: 10px'
        ,defaults: { border: false ,autoHeight: true }
        ,border: true
        ,items: [{
            title: _('players.view.tab-header')
            ,defaults: { autoHeight: true }
            ,items: [{
                html: '<p>'+_('players.view.panel-desc')+'</p><br />'
                ,border: false
            } ,{
                xtype: 'compositefield',
                labelWidth: 120,
                items: [{
                            xtype     : 'displayfield',
                            value: 'First Name:',
                            width     : 120
                        },
                        {
                            xtype     : 'displayfield',
                            value: 'Yehia A.Salam'
                        }
                ]
            }]
        }]
    }]
});
Players.panel.View.superclass.constructor.call(this,config);
};
Ext.extend(Players.panel.View,MODx.Panel);
Ext.reg('players-panel-view',Players.panel.View);

但是,'mgr/player/get' 永远不会被调用,我确信连接器工作正常,因为我已经在另一个网格小部件中使用它,我在这里遗漏了什么,我如何启动和 ajax 调用并填充显示字段。

感谢帮助,哇,没想到 Modx Revolution 的学习曲线会如此陡峭。

- 问候。叶希亚·萨拉姆

4

2 回答 2

0

您可能需要创建另一个自定义 xtype 来调用该连接器。

Players.panel.View = function(config) {
config = config || {};
Ext.apply(config,{
    border: false
    ,baseCls: 'modx-formpanel'
    ,items: [{
        html: '<h2>'+_('players.view.title')+'</h2>'
        ,border: false
        ,cls: 'modx-page-header'
    },{
        xtype: 'modx-tabs'
        ,bodyStyle: 'padding: 10px'
        ,defaults: { border: false ,autoHeight: true }
        ,border: true
        ,items: [{
            title: _('players.view.tab-header')
            ,defaults: { autoHeight: true }
            ,items: [{
                html: '<p>'+_('players.view.panel-desc')+'</p><br />'
                ,border: false
            } ,{
                // this thing is the one that has the url + baseParams
                // and renders the compositefields
                xtype: 'another-xtype-to-call-connector' 
                ,preventRender: true
            }]
        }]
    }]
});
Players.panel.View.superclass.constructor.call(this,config);
};
Ext.extend(Players.panel.View,MODx.Panel);
Ext.reg('players-panel-view',Players.panel.View);

在这里,MODx.Panel只是生成布局。

于 2012-09-14T06:25:35.157 回答
0

尝试添加包含要通过连接器检索的所有数据字段的“字段”参数。

像这样的东西:

Players.panel.View = function(config) {
config = config || {};
Ext.apply(config,{
    border: false
    ,baseCls: 'modx-formpanel'
    ,url: Players.config.connectorUrl
    ,baseParams: { action: 'mgr/player/get' }
    ,fields: [
          'id'
          ,'first_name'
          ,'last_name'
          ,...]
    ,...
});
...
于 2012-05-15T08:42:28.923 回答