1. #1
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    41
    Vote Rating
    0
    sdd0 is on a distinguished road

      0  

    Default Sencha Cmd cannot build a config object

    Sencha Cmd cannot build a config object


    Hi all,

    I have a config object(filename: Concentrator.js) as below:
    Code:
    {
         xtype: 'zyform',
        name: 'form3',
        putData2Store: function(form){
    
    
           },
           buildItem: function(){
               return[
                {
                    xtype:'zytitlepanel',
                    html: "Conventrator Setting"
                },    
                {
                      xtype: 'textfield',
                      name: 'email',
                      fieldLabel: 'Name',
                      vtype: 'email'  
                },
                {
                      xtype: 'textfield',
                      name: 'email',
                      fieldLabel: 'Email Address',
                      vtype: 'email'  
                }            
            ];
           }        
    }
    After I used simple cmd "sencha app build", it occurred errors:

    Code:
    [INF] Loading classpath entry D:\CMD\zldapp\build\temp\production\zldapp\sencha-
    compiler\app
    [ERR] C2000: Rhino Parse Error (missing ; before statement =>           name: 'f
    orm3',) -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:3:8
    [ERR] C2000: Rhino Parse Error (syntax error =>                 name: 'form3',)
    -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:3:8
    [ERR] C2000: Rhino Parse Error (missing ; before statement =>           name: 'f
    orm3',) -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:3:15
    [ERR] C2000: Rhino Parse Error (missing ; before statement =>           putData2
    Store: function(form){) -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:4:17
    [ERR] C2000: Rhino Parse Error (syntax error =>                 putData2Store: f
    unction(form){) -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:4:17
    [ERR] C2000: Rhino Parse Error (missing ; before statement =>           putData2
    Store: function(form){) -- D:\CMD\zldapp\app\view\VPN\Concentrator.js:4:26
    [ERR] C2000: Rhino Parse Error (syntax error =>        },) -- D:\CMD\zldapp\app\
    view\VPN\Concentrator.js:6:9
    [ERR] C2000: Rhino Parse Error (Compilation produced 7 syntax errors. => null) -
    - D:\CMD\zldapp\app\view\VPN\Concentrator.js:1
    [ERR]
    [ERR] BUILD FAILED
    [ERR] org.mozilla.javascript.EvaluatorException: Compilation produced 7 syntax e
    rrors.
    [ERR]
    [ERR] Total time: 3 seconds
    [ERR] The following error occurred while executing this line:
    D:\CMD\zldapp\.sencha\app\build-impl.xml:367: The following error occurred while
     executing this line:
    D:\CMD\zldapp\.sencha\app\js-impl.xml:11: org.mozilla.javascript.EvaluatorExcept
    ion: Compilation produced 7 syntax errors.
    Sencha cmd seems that it doesn't accept this file, it looks for a ";". Could anyone tell what's wrong?

  2. #2
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    41
    Vote Rating
    0
    sdd0 is on a distinguished road

      0  

    Default


    Does anyone have idea about these errors?

  3. #3
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    41
    Vote Rating
    0
    sdd0 is on a distinguished road

      0  

    Default


    I tried to set the json data in concentrator.js as a variable:


    Code:
    var test = {    xtype: 'zyform',
        name: 'form3',
        putData2Store: function(form){
    
    
        },
        buildItem: function(){
               return[
                {
                    xtype:'zytitlepanel',
                    html: "Conventrator Setting"
                },    
                {
                      xtype: 'textfield',
                      name: 'email',
                      fieldLabel: 'Name',
                      vtype: 'email'  
                },
                {
                      xtype: 'textfield',
                      name: 'email',
                      fieldLabel: 'Email Address',
                      vtype: 'email'  
                }            
            ];
         }        
    }


    It can be compiled now. but concentrator.js will not work in my app,
    because I use panel's autoload - loader:{ render:component, url:concentrator.js, autoload:true},
    under this situation, the loader do not accept "var test ={....}" as a component config object.
    It seems to be a very common case to use "autoload". Could anyone tell me the solution?

  4. #4
    Sencha Premium Member Fredric Berling's Avatar
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    186
    Vote Rating
    15
    Fredric Berling has a spectacular aura about Fredric Berling has a spectacular aura about

      1  

    Default


    Try renaming it concentrator.json instead.

  5. #5
    Sencha Premium Member
    Join Date
    May 2013
    Posts
    41
    Vote Rating
    0
    sdd0 is on a distinguished road

      0  

    Default


    Hi Fredric,

    I had tried to change concentrator.js as concentrator.json, it can be compiled. But if I use the "if directive" to remove the code in the block if any are false(as below), it will not work, it will remove all the content of json file.

    Code:
    {
         	xtype: 'zyform',
    		name: 'form3',
    		putData2Store: function(form){
    
    
           },
           buildItem: function(){
           	return[
    			{
    				xtype:'zytitlepanel',
    				html: "Conventrator Setting"
    			},    
    			//<if bar=1>
    			{
    			      xtype: 'textfield',
    			      name: 'email',
    			      fieldLabel: 'Name',
    			      vtype: 'email'  
    			},
    			//</if>
    			{
    			      xtype: 'textfield',
    			      name: 'email',
    			      fieldLabel: 'Email Address',
    			      vtype: 'email'  
    			}			
    		];
           }
    		
    }
    it is just like a deadlock, sencha cmd cannot compile a js file only with json data, and "if directive" cannot work in json file

Thread Participants: 1