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が指摘した構文エラーです。

第二に、「 Ext.app.formPanel名前空間を変更しないでください。

第 3 に、initComponentは引数を渡しません。

第 4 に、スーパークラスを適用するのではなく、呼び出す必要があります。引数がないため、引数を渡す必要もありません。

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 に答える