0

我正在尝试以马拉地语显示表格标签,因为我正在创建 marathi.js 这是我的 mararhi.js

if(Ext.app.formPanel) 
{
     Ext.apply(Ext.app.formPanel.prototype, 
                      {
                       selectUser:'नाव'
                      }
     );
}

我的其他 js 文件包含这个

var Ext.app.formPanel = Ext.extend(Ext.form.FormPanel,{
     selectUser:'Select User',
     initComponent : function(config) {
                 Ext.apply(this, {
                           title      : 'User Rights',
                           bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
                           labelWidth : 100,
                           width      : 755,
                           id         : 'formUserRights',
                           renderTo:'adminpanel',
                           items      : [   id: 'User',
                                        fieldLabel:this.selectUser,
                                        width:200
                            ] //items
                 });//Ext.apply
                 Ext.app.formPanel.superclass.initComponent.apply(this, arguments);
         }//init component
}); //yuyu
......
....

但它不能工作它给出错误; missing before var Ext.app.formPanel = Ext.extend..... 但是当我仔细检查所有东西时,每件事都正确嵌套。

4

1 回答 1

0

首先,vava在上面的评论中指出的语法错误。

其次,你不应该var 'Ext.app.formPanel'命名空间

第三,initComponent不传递任何参数。

第四,你需要调用超类,而不是应用它——也不需要传递参数,因为没有。

Ext.ns('Ext.app');
Ext.app.formPanel = Ext.extend(Ext.form.FormPanel, {
selectUser : 'Select User',
initComponent : function() {
    Ext.apply(this, {
        title : 'User Rights',
        bodyStyle : 'padding: 10px; background-color: #DFE8F6',
        labelWidth : 100,
        width : 755,
        id : 'formUserRights',
        renderTo : 'adminpanel',
        items : [ {
            id : 'User',
            fieldLabel : this.selectUser,
            width : 200
        } ]
    });
    Ext.app.formPanel.superclass.initComponent.call(this);
}
});

附带说明一下,我不喜欢在我的应用程序代码中使用 Ext 命名空间,那样有可能发生冲突。我建议创建自己的命名空间。

在家里享受这个,希望有一天你会真正奖励答案。

于 2010-03-10T00:29:40.917 回答