1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Lightbulb [SOLVED]General question - SQLiteStore Loading + Combo

    [SOLVED]General question - SQLiteStore Loading + Combo


    Hello All,

    I've noticed a lot of threads circling around some of the same issues. I was wondering if it would not be a bad idea to put together a small thread like Makana did with the ext-air.js updated build.

    From what I see, there are several threads and issues surrounding Comboboxes and SQLite stores. There are also some good threads on how to make this easier but thre are no definiteve guides. Grids are fantastic, but if you are using an editable grid, you will run into requiring comboboxes nevertheless.

    Just was wondering if a how-to SQLite store+combo+filters+clauses would not be bad to have?
    I myself have been beating my head at a wall week trying to understand how to filter/use clauses in the SQLite store . I'm sure I will not be the first and last to come across this.

    Just a thought

    Jack

  2. #2
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    Due to the posts here and some annoyance, espacially from Pranke (don't take it personally! I understand it, since I ran into the same problems), about working with the SQLiteStore, first of all about doing the insert/update/delete stuff via the store, not the database, I think, it's time to review this and do some improvements on it.

    I like the idea to manage database recordsets via the store, so I think, this should be preserved.
    I will take the time to think about it and do some coding and testing.

    Please give your opinions, what should be included and what should not.
    Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

  3. #3
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Default Comments

    Comments


    Hello Makana,

    Thanks for your input. I will be happy to help with testing and assist anyway I can.

    I think, at least from my view point, in terms of the store and combobox (custom registered xtypes:

    Params:
    --------
    WORKING as they should (combo-grid)
    =================
    conn: [no change requried]
    start - limit : [no change required]
    viewName: [no change required]


    REVIEW and CONSIDERATION
    ======================
    sqlStr: query bound store [worth a investigation]

    Listeners on combo bound stores:
    ========================
    beforeload: not sure if it works properly
    beforeselect: not sure if it works properly
    select: [when using start-limit params, it never select the proper record in the store, only the record at the top of the page(paging)

    I did notice that there some issues when creating custom xtypes, certain parameters seem to ignored, such as 'autoLoad'.

    Also, I think one of the things that I would emphasize on is how to limit the amount of data rerturned from the database:

    ie. I cannot get soemthing liek this to work inside a store:
    Code:
    "SELECT * FROM ori_administrators WHERE administrator_type = 'COUNTRY'"
    These are just my thoughts. Thanks for your considerations in advance.

    If you would like a simple case I can provide an example, where combobox 'select' doesn't work properly, and conditional store loads seem to be ignored, as well as the autoload.

    Regards

    Jack

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    330
    Vote Rating
    1
    PranKe01 is on a distinguished road

      0  

    Default


    I think there should be made a change with the connection. A synchronious connection is so damn slow. Every time I access the databse, my program does not react.
    Another idea I had, was that there is right now no possibility to extend a table with new fields (or even to remove fields) and it is not possible to set default-values.
    If anything of these three points are possible, please correct me

  5. #5
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Default


    Hello Pranke,

    Being a database administrator myself, I see no reason why to integrate a feature of creating columns with default values inside of Ext.

    You should always create your tables as needed. What you are talking about is to turn Ext on Air into something like MySQL Admin, or Toad, or SQL Developer etc.

    But I would agree that, an asyncronous aconnection would not be a bad idea. Air by default uses async, where as Ext uses sync. I leave this to some more experienced programmer.

    Jack

  6. #6
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    Quote Originally Posted by Jack_S View Post
    I see no reason why to integrate a feature of creating columns with default values inside of Ext.

    You should always create your tables as needed. What you are talking about is to turn Ext on Air into something like MySQL Admin, or Toad, or SQL Developer etc.
    That's exactly what I was thinking when reading Pranke's post... I think, database structure should be ready when using the app.... only selects and inserts/updates/deletes of recordsets should be necessary....

    @Pranke01:I don't know, if you really need the functionality of creating tables etc. or if you only need a sqlite database administrator like Firebug's SQLiteManager to manage your database structure.....


    I agree with the async stuff and will look, what is possible when I review the sqlite stuff in my adapter.
    Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

  7. #7
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Lightbulb viewName parameter inclusion not working

    viewName parameter inclusion not working


    Hello Makana,

    I tested the viewName parameter in my combo store and I'm getting the following error:

    Code:
    Error #1056: Cannot create property stackTrace on flash.errors.SQLError.
    I tried to implement your code directly into ext-air.js but somehow may have done something wrong. Definitely should include this parameter extension into the ext-air.js

    This is how to implemented your extension code:
    Code:
    ****around line 1653:
              getTable : function(name, keyName){
    		return new Ext.sql.Table(this, name, keyName);
    	},
    	
    	//SQLite Modification - Extention
    	//Makana viewName parameter
    	getView: function(name){
    		return new Ext.sql.View(this, name);
    	}, //eo mod
    
    
    
    
    ****around line 2000
    
    .......onRemove : function(ds, record, index){
    		var kn = this.table.keyName;
    		this.table.removeBy(kn + ' = ?', [record.data[kn]]);
    	}
    });
    /SQLite Modification - Extention
    //Makana viewName parameter
    Ext.sql.View = Ext.extend(Ext.sql.Table, {
    	constructor: function(conn, name) {
    		this.conn = conn;
    		this.name = name;
    	},
    	update: Ext.emptyFn,
    	updateBy: Ext.emptyFn,
    	insert: Ext.emptyFn,
    	lookup: Ext.emptyFn,
    	exists: Ext.emptyFn,
    	save: Ext.emptyFn,
    	remove: Ext.emptyFn,
    	removyBy: Ext.emptyFn
    });
    //eo mod
    
    Ext.sql.AirConnection = Ext.extend(Ext.sql.Connection, {
    	// abstract methods
    	open : function(db){
    		this.conn = new air.SQLConnection();
    		var file = air.File.applicationDirectory.resolvePath(db);
    		this.conn.open(file);
    		this.openState = true; ......
    
    
    
    ****Overwrite the store definition
    ****Around line 1700
    
    Ext.sql.SQLiteStore = Ext.extend(Ext.data.Store, {
    	constructor: function(config) {
    		config = config || {};
    		config.reader = new Ext.data.JsonReader({
    			idProperty: config.key,
    			totalProperty: config.totalProperty,
    			root: config.root,
    			fields: config.fields
    		});
    		var conn;
    		if (!config.conn || config.dbFile) {
    			conn = Ext.sql.Connection.getInstance();
    			conn.open(config.dbFile);
    		} else conn = config.conn;
    		
    		/*
    		if (config.createTable === true) conn.createTable({
    			name: config.tableName,
    			key: config.key,
    			fields: config.reader.recordType.prototype.fields
    			
    		});*/
    
    		//Makana's extension for viewName
    		if (!config.viewName) {
            	
    			conn.createTable({
                		name: config.tableName,
                		key: config.key,
                		fields: config.reader.recordType.prototype.fields
            	});
            	var table = conn.getTable(config.tableName, config.key);
            } else var table = conn.getView(config.viewName);
    
    		Ext.sql.SQLiteStore.superclass.constructor.call(this, config);
    
    		this.proxy = new Ext.sql.Proxy (conn, table, this, config.api);
    	}
    });

  8. #8
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    If you use the modified adapter, use "tableName" instead. I removed the viewName, because a view in ext-air is almost the same as a table.
    If you want to make it readonly, configure your store with
    Code:
    api:{create:false,update:false,destroy:false}
    otherwise you can make inserts/updates/deletes von views, too. Then you have to define triggers on your view.

    see: http://www.extjs.com/forum/showthrea...006#post437006
    Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

  9. #9
    Sencha User
    Join Date
    Apr 2008
    Posts
    330
    Vote Rating
    0
    Jack_S is on a distinguished road

      0  

    Question Combo store issue - using Views

    Combo store issue - using Views


    Hello Makana,

    So I've undone all the changes I made and have reverted back to the original modified ext-air-debug.

    But I can seem to get away from this error:
    Code:
    Error #1056: Cannot create property stackTrace on flash.errors.SQLError.
    Here is how I've defined my view:

    Code:
    CREATE VIEW "VW_COUNTRY_ADMINS" AS      SELECT ADMINISTRATOR_ID as id, ADMINISTRATOR_NAME as text FROM ORI_ADMINISTRATORS WHERE ADMINISTRATOR_TYPE = 'COUNTRY' ORDER BY  2
    Here is my custom XTYPE combo:

    Code:
    iApplication.module.comboCountryAdmins = Ext.extend(Ext.form.ComboBox,
    {
      initComponent: function()
      {
        Ext.apply(this, {
          store: new Ext.sql.SQLiteStore({
                         conn: iApplication.module.DB
    					,api:{create:false,update:false,destroy:false}
    					,tableName: 'VW_COUNTRY_ADMINS'
    					//,key: 'ADMINSTRATOR_ID'
    					,key: 'id'
    					,fields: [ 
                               		 {name: 'id', type: 'int'}
                              		,{name: 'text', type: 'string'}
                        ]
          }),
           valueField: 'id'
          ,displayField: 'text'
          ,triggerAction: 'all'
          //,typeAhead: false
          ,emptyText:'Select Employee...'
          ,width: 160
          ,fieldLabel: 'Employee'
          ,lazyRender: true
    	  ,tpl: Templates.comboTpl
        })
    	  iApplication.module.comboCountryAdmins.superclass.initComponent.apply(this, arguments);
    	}
    });
    Ext.reg('combo-country-admins', iApplication.module.comboCountryAdmins);
    And finally my template:
    Code:
    Templates = {
    	comboTpl: new Ext.XTemplate(
    		'<tpl for="."><div class="x-combo-list-item">{text}</div></tpl>'
    	)};

    I've tried many combinations, but I'm not sure if the problem is with the store, or the template?

    Any thoughts

    Thanks Jack

  10. #10
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    Hmm, seems like a sql error... I cannot order by 2! do you have such a named column? I've testet and the query works if it is quoted....
    Code:
    ORDER BY "2"
    all other should be right...

    btw, you don't need to define such a template which does nothing, except of showing the displayField. It's implemented in the adapter to use the default template...
    Programming today is a race between software engineers striving to build bigger and better іdiot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi