1. #111
    Sencha User
    Join Date
    Aug 2011
    Posts
    66
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default


    This is the Model code

    Code:
    Ext.define('NDP.model.menuList', {
      extend: 'Ext.data.Model',
      config : {
    	  fields: [
    	           		{name: 'menuID', type: 'string'},
    	           		{name: 'menuName', type: 'string'},
    					{name: 'menuParentID', type: 'string'},
    					{name: 'menuParentName', type: 'string'},
    					{name: 'pattuName', type: 'string'},
    					{name: 'leaf', type: 'boolean'},
    					{name: 'createdBy', type: 'string'}
    	  ],
    		  proxy: {
    		      type: 'sqlitestorage',
    				dbConfig :{
    					tablename 	: 'menuList',
    					dbConn: NDP.util.InitSQLite.getConnection()
    				},
    		
    				reader : {
    					idProperty : 'menuID',
    					type:'array'
    				}
    		  },
    	
    		  writer: {
    		      type: 'json'
    		  }
    		
      }
    
    
    });
    Here is the list declaration

    Code:
    			    		        {
    				    		        xtype: 'list',
    							        flex:1,
    							       // allowDeselect:true,
    							        deselectOnContainerClick:true,
    				                    store: 'menuList',
    				    				itemTpl:'<span class="item-title">{menuName}</span><tpl if="leaf !== true"><span class="x-list-disclosure"></span></tpl>',
    							        id:'menuListView',
    							        scrollable:'vertical'}
    As I mentioned the store is loaded with 154 records now (as per in D issue is that list still keeps showing loading (no data visible).

  2. #112
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    73
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    So I don't know if this is the issue stopping it here, but you need the first field of the model to just be called "id" of type integer. It must be exactly that and it's case sensitive. The proxy does not take not of the idProperty config - comment the whole reader bit out of the config to be safe.

    Hopefully it will work then! I imagine the transaction is not returning because it's trying to set a field on the model ("id"), that doesn't exist.

  3. #113
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    91
    Vote Rating
    2
    zmagyar is on a distinguished road

      0  

    Default


    The defined associations didn't have any affect on that. It was the same after removing the definitions from the models.

    Finally I have found that it was down to the autoLoad and autoSync flags. By some reason multiple records are created when these flags are on. It's quite weird.

  4. #114
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    73
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    I could see how that might happen if you were manually calling store.sync as well as letting the autosync try to sync it?

  5. #115
    Sencha Premium Member zmagyar's Avatar
    Join Date
    Mar 2012
    Location
    Budapest
    Posts
    91
    Vote Rating
    2
    zmagyar is on a distinguished road

      0  

    Default


    Yep, exactly that was the case.

  6. #116
    Sencha User
    Join Date
    Jun 2012
    Posts
    2
    Vote Rating
    0
    bbjay is on a distinguished road

      0  

    Default


    @martv: i had the same "SECURITY_ERR: DOM Exception 18" error during a package build.
    I was able to resolve this by setting dbSize back to 5mb

  7. #117
    Sencha User
    Join Date
    May 2012
    Posts
    131
    Vote Rating
    6
    klaus777 is on a distinguished road

      0  

    Default


    Working mucho excellente. Thank you !!! :-)

    How are you doing a select statement on a table, to query certain records?

    So far I started with this, but don't know how to continue:

    Code:
    var myStore = Ext.getStore('SQLiteDB');
    var p = myStore.getProxy();
    // p.doThatSexyQueryNow!!!!(); ;)

    Please, please please please please provide a simple example on how to do a simple SELECT :-)

  8. #118
    Sencha User
    Join Date
    Jan 2012
    Location
    London, UK
    Posts
    508
    Vote Rating
    73
    shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough shepsii is a jewel in the rough

      0  

    Default


    The proxy supports remoteFilter's and I believe sorts too... what do you need to do with a select query that you can't do with those? e.g. turn remoteFilter on on the store, set a filter on the store and load the store, and the proxy will create a select query with the filters included.

    The problem with using a select query is you're bypassing a lot of stuff that the proxy needs to do on the returned results, and you're losing the possibility of switching to another proxy in the future.

  9. #119
    Sencha User
    Join Date
    May 2012
    Posts
    131
    Vote Rating
    6
    klaus777 is on a distinguished road

      0  

    Default


    Well I have 2 tables...

    Artist Table and Track Table...


    So I hope I can do a query to get all tracks from an artist or something.

    I'm still trying to understand Sencha as such, so this SQLite isn't that easy for me to understand :-)


    But sooner or later I will have to do sth like this here and I thought I'd do this with a SELECT:
    http://stackoverflow.com/questions/7...t-foreign-keys

  10. #120
    Sencha User
    Join Date
    May 2012
    Posts
    131
    Vote Rating
    6
    klaus777 is on a distinguished road

      0  

    Default


    Is there support for associations?

    Or how can you make SQL statements work, the most common task in sql-environments?

    Or should I program this myself, with some javascript?

    Or should I use phonegap sqlite plugin to make SQL statements?


    There must be foreign keys, primary keys and selects/queries to make sql work like it should work :-)

    Whats the best approach?