Results 1 to 2 of 2

Thread: Showing error "root is undefined" where i am wrong?

  1. #1
    Sencha User jaisonjames's Avatar
    Join Date
    Jul 2010
    Posts
    67
    Vote Rating
    1
      0  

    Default Showing error "root is undefined" where i am wrong?

    Showing error "root is undefined" where i am wrong? Code below
    Code:
    var myData = {
                records : [
                    { fname : 'Jaison', lname : 'James'},
                    { fname : 'Sreejith', lname : 'K'},
                    { fname : 'Ajai', lname : 'Robin'},
                    { fname : 'Sandeep', lname : 'U'},
                    { fname : 'Jaison', lname : 'James'},
                    { fname : 'Sreejith', lname : 'K'},
                    { fname : 'Ajai', lname : 'Robin'},
                    { fname : 'Sandeep', lname : 'U'},
                    { fname : 'Jaison', lname : 'James'},
                    { fname : 'Sreejith', lname : 'K'},
                    { fname : 'Ajai', lname : 'Robin'},
                    { fname : 'Jaison', lname : 'James'},
                    { fname : 'Sreejith', lname : 'K'},
                    { fname : 'Ajai', lname : 'Robin'},
                    { fname : 'Sandeep', lname : 'U'},
                    { fname : 'Jaison', lname : 'James'},
                    { fname : 'Sreejith', lname : 'K'},
                    { fname : 'Ajai', lname : 'Robin'},
                    { fname : 'Sandeep', lname : 'U'}
                ]
            };
        
        
            // Generic fields array to use in both store defs.
            var fields = [
                {name: 'fname', mapping : 'fname'},
                {name: 'lname', mapping : 'lname'}
            ];
        
            // create the data store
            var firstGridStore = new Ext.data.JsonStore({
                fields : fields,
                data   : myData,
                root   : 'records'
            });
        
        
            // Column Model shortcut array
            var cols = [
                { id : 'name', header: "<b>First Name</b>", width: 100, sortable: true, dataIndex: 'fname'},
                {header: "<b>Last Name</b>", width: 100, sortable: true, dataIndex: 'lname'}
            ];
    Code:
    Ext.ns('Ext.ux.form');
    
            Ext.ux.form.SearchField = Ext.extend(Ext.form.TwinTriggerField, {
                initComponent : function(){
                    Ext.ux.form.SearchField.superclass.initComponent.call(this);
                    this.on('specialkey', function(f, e){
                        if(e.getKey() == e.ENTER){
                            this.onTrigger2Click();
                        }
                    }, this);
                },
            
                validationEvent:false,
                validateOnBlur:false,
                trigger1Class:'x-form-clear-trigger',
                trigger2Class:'x-form-search-trigger',
                hideTrigger1:true,
                width:180,
                hasSearch : false,
                paramName : 'query',
            
                onTrigger1Click : function(){
                    if(this.hasSearch){
                        this.el.dom.value = '';
                        var o = {start: 0};
                        this.store.baseParams = this.store.baseParams || {};
                        this.store.baseParams[this.paramName] = '';
                        this.store.loadData({params:o});
                        this.triggers[0].hide();
                        this.hasSearch = false;
                    }
                },
            
                onTrigger2Click : function(){
                    var v = this.getRawValue();
                    if(v.length < 1){
                        this.onTrigger1Click();
                        return;
                    }
                    var o = {start: 0};
                    this.store.baseParams = this.store.baseParams || {};
                    this.store.baseParams[this.paramName] = v;
                    var root = this.getRoot(o);
                    this.store.loadData({params:o});
                    this.hasSearch = true;
                    this.triggers[0].show();
                }
            });
            
            var simple = new Ext.ux.form.SearchField({
                    store: firstGridStore,
                    width:240
                });

  2. #2
    Sencha User jaisonjames's Avatar
    Join Date
    Jul 2010
    Posts
    67
    Vote Rating
    1
      0  

    Default

    no idea ?

Similar Threads

  1. restful json store "root is undefined"
    By richz3508 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 3 Dec 2010, 7:18 AM
  2. [Solved]Ext.data.JsonStore giving a "root is undefined" error.
    By nickweavers in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 26 Dec 2009, 11:05 AM
  3. datastore load error"root is undefined"
    By netbox in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 17 Mar 2009, 1:39 AM
  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: 9
    Last Post: 20 Jun 2007, 7:36 PM

Posting Permissions

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