Results 1 to 5 of 5

Thread: phonegap ST2.0.1 Data binding problems

  1. #1
    Sencha User sailei1's Avatar
    Join Date
    Jul 2011
    Location
    BeiJing China
    Posts
    43

    Default phonegap ST2.0.1 Data binding problems

    I to use wnielson of custom plug-in(slidenavigationview)
    http://wnielson.github.com/sencha-SlideNavigation/docs/#!/api/Ext.ux.slidenavigation.View-event-initialize
    Code:
    /**
     * ???
     */
    Ext.define("Email.view.home.Main", {
        extend: 'Email.view.home.Slidenavigation',
        requires: [
            'Ext.Container',
            'Ext.MessageBox',
            'Ext.Panel',
            'Ext.Toolbar',
            'Ext.event.publisher.Dom',
            'Email.view.WorkList'
        ],
        config: {
            fullscreen: true,
             
            /**
             *  Any component within the container with an 'x-toolbar' class
             *  will be draggable.  To disable draggin all together, set this
             *  to false.
             */
            slideSelector: 'x-toolbar',
            
            /**
             *  Time in milliseconds to animate the closing of the container
             *  after an item has been clicked on in the list.
             */
            selectSlideDuration: 200,
             
            /**
             *  This allows us to configure how the actual list container
             *  looks.  Here we've added a custom search field and have
             *  modified the width.
             */
            list: {
                maxDrag: 400,
                width: 200,
                items: [{
                    xtype: 'toolbar',
                    docked: 'top',
                    ui: 'light',                    
                    title: {
                        title: '???',
                        centered: false,
                        width: 200,
                        left: 0
                    },
                    
                }]
                
            },
           
    //        
            /**
             *  Example of how to re-order the groups.
             */
    //        groups: {
    //            '??': 1,
    //            '??': 2
    //            
    //        },
            
            /**
             *  These are the default values to apply to the items within the
             *  container.
             */
            defaults: {
                style: 'background: #fff',
                xtype: 'container'
            },
            
    
    
        },
        initConfig:function(){
    	var  me=this;
    	debugger;
    	var json=[{"ORG_NAME":"???","ORG_ID":"26"},{"ORG_NAME":"????????","ORG_ID":"53"},{"ORG_NAME":"?????","ORG_ID":"21"},{"ORG_NAME":"???","ORG_ID":"20"},{"ORG_NAME":"?????","ORG_ID":"52"},{"ORG_NAME":"?????","ORG_ID":"41"},{"ORG_NAME":"?????","ORG_ID":"67"},{"ORG_NAME":"?????","ORG_ID":"68"},{"ORG_NAME":"?????","ORG_ID":"70"},{"ORG_NAME":"???","ORG_ID":"23"},{"ORG_NAME":"?????","ORG_ID":"51"},{"ORG_NAME":"???","ORG_ID":"28"},{"ORG_NAME":"???","ORG_ID":"60"},{"ORG_NAME":"?????","ORG_ID":"45"},{"ORG_NAME":"?????","ORG_ID":"61"},{"ORG_NAME":"??","ORG_ID":"43"},{"ORG_NAME":"??????","ORG_ID":"44"},{"ORG_NAME":"??????","ORG_ID":"25"},{"ORG_NAME":"????????","ORG_ID":"24"},{"ORG_NAME":"??????","ORG_ID":"42"},{"ORG_NAME":"????","ORG_ID":"47"},{"ORG_NAME":"????","ORG_ID":"50"},{"ORG_NAME":"????","ORG_ID":"29"},{"ORG_NAME":"????????","ORG_ID":"71"},{"ORG_NAME":"?????","ORG_ID":"62"},{"ORG_NAME":"?????","ORG_ID":"63"},{"ORG_NAME":"??????","ORG_ID":"64"},{"ORG_NAME":"?????","ORG_ID":"65"},{"ORG_NAME":"?????","ORG_ID":"66"},{"ORG_NAME":"?????","ORG_ID":"31"},{"ORG_NAME":"?????","ORG_ID":"38"},{"ORG_NAME":"?????","ORG_ID":"36"},{"ORG_NAME":"?????","ORG_ID":"35"},{"ORG_NAME":"?????","ORG_ID":"40"},{"ORG_NAME":"?????","ORG_ID":"34"},{"ORG_NAME":"?????","ORG_ID":"32"},{"ORG_NAME":"?????","ORG_ID":"39"},{"ORG_NAME":"?????","ORG_ID":"33"}];
    	
    	var items=[];
    	    	for(var i=0;i<json.length;i++){
    	    	var dep=json[i].ORG_NAME;
    	    	var id=json[i].ORG_ID;
    	 var t={
    	            title: dep,
    
    
    	            slideButton: {
    	                selector: 'toolbar'
    	            },
    	            items: [{
    	                xtype: 'toolbar',
    	                title: '',
    	                docked: 'top'
    	            },{
    	               html:id
    	            }]
    	        };
    	        items.push(t);
    	    	dep=null;id=null;
    	    	};
    	    	debugger;
    	    	me.config.items=items;
    	    	me.callParent();
    	 }
    	 
    	
    });
    
    Operating normally
    Code:
    /**
     * ???
     */
    Ext.define("Email.view.Main", {
        extend: 'Email.view.Slidenavigation',
      
        requires: [
            'Ext.Container',
            'Ext.MessageBox',
            'Ext.Panel',
            'Ext.Toolbar',
            'Ext.event.publisher.Dom'
        ],
        config: {
            fullscreen: true,
             
            /**
             *  Any component within the container with an 'x-toolbar' class
             *  will be draggable.  To disable draggin all together, set this
             *  to false.
             */
            slideSelector: 'x-toolbar',
            
            /**
             *  Time in milliseconds to animate the closing of the container
             *  after an item has been clicked on in the list.
             */
            selectSlideDuration: 200,
             
            /**
             *  This allows us to configure how the actual list container
             *  looks.  Here we've added a custom search field and have
             *  modified the width.
             */
            list: {
                maxDrag: 400,
                width: 200,
                items: [{
                    xtype: 'toolbar',
                    docked: 'top',
                    ui: 'light',                    
                    title: {
                        title: '???',
                        centered: false,
                        width: 200,
                        left: 0
                    }
                    
                }]
                
            },
    
    
          
            defaults: {
                style: 'background: #fff',
                xtype: 'container'
            }
            
        },
        initConfig:function(){
    	debugger;
    	var  self=this;
    	var items=[];
    	 var db = new PGSQLitePlugin("addressBook.db", function(dbResult, dbObject){
    	      
    	       db = dbObject;
    	       db.executeSql("select ORG_ID ,ORG_NAME from KM_ORG WHERE ORG_TYPE='0' order by ORG_ORDER asc", function(data){
    	    	 var json=  data.rows;
    	    	 alert(json[0].ORG_NAME);
    	    	//console.log(json);
    	    	for(var i=0;i<json.length;i++){
    	    	var dep=json[i].ORG_NAME;
    	    	var id=json[i].ORG_ID;
    	        var t={
    	            title: dep,
    	            slideButton: {
    	                selector: 'toolbar'
    	            },
    	            items: [{
    	                xtype: 'toolbar',
    	                title: '',
    	                docked: 'top'
    	            },{
    	                xtype: 'panel',
    	               items:[{xtype:'button',text: id}]
    	            }]
    	        };
    	        console.log(t.title);
    	        items.push(t);
    	    	};
    	   
    	    	self.config.items=items; 
    	    	self.callParent();
    	    	
    	    	
    	    	
    	       }, function(err){
    		       console.log( err);
    		   });
    	   }, function(err){
    	       console.log( err);
    	   });  
        }
        
    });

  2. #2
    Sencha User sailei1's Avatar
    Join Date
    Jul 2011
    Location
    BeiJing China
    Posts
    43

  3. #3
    Sencha User sailei1's Avatar
    Join Date
    Jul 2011
    Location
    BeiJing China
    Posts
    43

    Default

    The log
    08-06 14:49:13.450: E/PGSQLitePlugin(17569): Plugin Called
    08-06 14:49:13.450: I/PGSQLitePlugin(17569): open action:torageinternal
    08-06 14:49:13.450: I/PGSQLitePlugin(17569): open action::addressBook.db
    08-06 14:49:13.560: D/CordovaLog(17569): Uncaught TypeError: Cannot call method 'getAt' of null
    08-06 14:49:13.560: D/CordovaLog(17569): file:///android_asset/www/lib/sencha-touch-all-debug.js: Line 18866 : Uncaught TypeError: Cannot call method 'getAt' of null
    08-06 14:49:13.560: E/Web Console(17569): Uncaught TypeError: Cannot call method 'getAt' of null at file:///android_asset/www/lib/sencha-touch-all-debug.js:18866
    08-06 14:49:13.570: E/PGSQLitePlugin(17569): Plugin Called
    08-06 14:49:13.570: E/PGSQLitePlugin(17569): rawQuery action:ql=select ORG_ID ,ORG_NAME from KM_ORG WHERE ORG_TYPE='0' order by ORG_ORDER asc
    08-06 14:49:13.580: E/PGSQLitePlugin(17569): rawQuery action::count=38
    08-06 14:49:15.320: D/DroidGap(17569): onMessage(spinner,stop)
    08-06 14:49:16.870: D/CordovaLog(17569): ???
    08-06 14:49:16.870: D/CordovaLog(17569): file:///android_asset/www/app/view/Main.js: Line 89 : ???
    08-06 14:49:16.870: I/Web Console(17569): ??? at file:///android_asset/www/app/view/Main.js:89
    08-06 14:49:16.870: D/CordovaLog(17569): ????????
    08-06 14:49:16.870: D/CordovaLog(17569): file:///android_asset/www/app/view/Main.js: Line 89 : ????????
    08-06 14:49:16.880: I/Web Console(17569): ???????? at file:///android_asset/www/app/view/Main.js:89

  4. #4
    Sencha User sailei1's Avatar
    Join Date
    Jul 2011
    Location
    BeiJing China
    Posts
    43

    Default

    Code:
    /**
     * 
     */
    Ext.define("Email.view.Main", {
        extend: 'Email.view.Slidenavigation',
      
        requires: [
            'Ext.Container',
            'Ext.MessageBox',
            'Ext.Panel',
            'Ext.Toolbar',
            'Ext.event.publisher.Dom'
        ],
        config: {
            fullscreen: true,
             
            /**
             *  Any component within the container with an 'x-toolbar' class
             *  will be draggable.  To disable draggin all together, set this
             *  to false.
             */
            slideSelector: 'x-toolbar',
            
            /**
             *  Time in milliseconds to animate the closing of the container
             *  after an item has been clicked on in the list.
             */
            selectSlideDuration: 200,
             
            /**
             *  This allows us to configure how the actual list container
             *  looks.  Here we've added a custom search field and have
             *  modified the width.
             */
            list: {
                maxDrag: 400,
                width: 200,
                items: [{
                    xtype: 'toolbar',
                    docked: 'top',
                    ui: 'light',                    
                    title: {
                        title: '???',
                        centered: false,
                        width: 200,
                        left: 0
                    }
                    
                }]
                
            },
    
    
          
            defaults: {
                style: 'background: #fff',
                xtype: 'container'
            }
            
        },
        initConfig:function(){
    	debugger;
    	var  self=this;
    	var items=[];
    	 var db = new PGSQLitePlugin("addressBook.db", function(dbResult, dbObject){
    	      
    	       db = dbObject;
    	       db.executeSql("select ORG_ID ,ORG_NAME from KM_ORG WHERE ORG_TYPE='0' order by ORG_ORDER asc", function(data){
    	    	 var json=  data.rows;
    	    	 alert(json[0].ORG_NAME);
    	    	//console.log(json);
    	    	for(var i=0;i<json.length;i++){
    	    	var dep=json[i].ORG_NAME;
    	    	var id=json[i].ORG_ID;
    	        var t={
    	            title: dep,
    	            slideButton: {
    	                selector: 'toolbar'
    	            },
    	            items: [{
    	                xtype: 'toolbar',
    	                title: '',
    	                docked: 'top'
    	            },{
    	                xtype: 'panel',
    	               items:[{xtype:'button',text: id}]
    	            }]
    	        };
    	        console.log(t.title);
    	        items.push(t);
    	    	};
    	   
    	    	self.config.items=items; 
    	    	self.callParent();
    	    	
    	    	
    	    	
    	       }, function(err){
    		       console.log( err);
    		   });
    	   }, function(err){
    	       console.log( err);
    	   });  
        }
        
    });

  5. #5
    Sencha User sailei1's Avatar
    Join Date
    Jul 2011
    Location
    BeiJing China
    Posts
    43

    Default

    Code:
     var data=null;
    		 var db = new PGSQLitePlugin("addressBook.db", function(dbResult, dbObject){
    		      
    		       db = dbObject;
    		       db.executeSql("select * from KM_USER where USER_NAME like '%?%'", function(data){
    			    // alert(data.rows[0].MOBILE);
    			   data=data.rows;
    			   Ext.create('Ext.TabPanel', {
    				    fullscreen: true,
    				    tabBarPosition: 'left',
    
    
    				    defaults: {
    				        styleHtmlContent: true
    				    },
    
    
    				    items: [
    				        {
    				            title: 'Home',
    				            xtype:'list',
    				            itemTpl: '{USER_NAME}{MOBILE}',
    				            indexbar:true,
    				            data:data
    				        },
    				        {
    				            title: 'Contact',
    				            iconCls: 'user',
    				            html: 'Contact Screen'
    				        }
    				    ]
    				});
    			   
    			   }, function(err){
    			       console.log( err);
    			   });
    		   }, function(err){
    		       console.log( err);
    		   });
    But this is operating normally .sorry! I am Chinese bad English!

Posting Permissions

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