views:

29

answers:

1

i am tring to display lable of form in marathi language for that am creating marathi.js this my mararhi.js

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

and my other js file contain this

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
......
....

but it can not work it gives error ; missing before var Ext.app.formPanel = Ext.extend..... but when i checked all carefully every thing is correctly nested.

A: 

First thing, the syntax error that vava noted in his comment above.

Second, you should not var the 'Ext.app.formPanel' namespace.

Third, initComponent does not pass any arguments.

Fourth, you need to call the superclass, not apply it - also no need to pass arguments, as there are none.

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

On a side note, I prefer not to use the Ext namespace for my app code, there is a chance for collision that way. I would suggest creating your own namespace.

Enjoy this one on the house, with the hope that someday you will actually award answers.

Shea Frederick