PDA

View Full Version : Error : "Expected :"



ajay.kumar2
2 Dec 2010, 2:08 PM
I am trying to generate a object inside componentOne function of MyContainer, but

I am getting an error at line
display.get('name'):value, th error is "Expected :"

Note : display.get('name') returns a string value

thanks,



MyContainer = Ext.extend(Ext.Container, {

initComponent: function(){
//some code
},
componentOne:function(value){

alert(display.get('name')); //get a alert here "Name"

var myObj=
{
display.get('name'):value
}

}

evant
2 Dec 2010, 2:33 PM
If you specify a property name like that is has to be a literal. Otherwise, you need:



var o = {};
o[display.get('name')] = value;

ajay.kumar2
2 Dec 2010, 2:52 PM
thanks a lot! It works this way.