Results 1 to 3 of 3

Thread: Error : "Expected :"

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2010
    Posts
    44

    Exclamation Error : "Expected :"

    I am trying to generate a object inside componentOne function of MyContainer, but

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

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

    thanks,

    Code:
     
    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
    }
     
    }

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    If you specify a property name like that is has to be a literal. Otherwise, you need:

    Code:
    var o = {};
    o[display.get('name')] = value;
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2010
    Posts
    44

    Default

    thanks a lot! It works this way.

Similar Threads

  1. Replies: 6
    Last Post: 21 Apr 2010, 10:06 AM
  2. IE6 - "object expected" errors when closing windows.
    By zhegwood in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 4 Jan 2010, 1:58 PM
  3. Replies: 8
    Last Post: 22 Jun 2009, 8:56 PM
  4. ComboBox error: Ext={version:"2.2"};window["undefined"]=...
    By Dr. Flink in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 9 Sep 2008, 1:49 PM
  5. Replies: 1
    Last Post: 4 May 2007, 4:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •