-
12 Feb 2010 10:02 AM #31
ListView Override - Consideration
ListView Override - Consideration
Hello Makana,
Please consider adding ther following ListView Override into the air-debug.js you have created.
This si from Timothy post on teh first page of: http://www.extjs.com/forum/showthread.php?t=65654
Code:Ext.override(Ext.ListView, { //Ext.ListView.override({ initComponent : function(){ if(this.columnResize){ this.colResizer = new Ext.ListView.ColumnResizer(this.colResizer); this.colResizer.init(this); } if(this.columnSort){ this.colSorter = new Ext.ListView.Sorter(this.columnSort); this.colSorter.init(this); } var cs = this.columns, allocatedWidth = 0, colsWithWidth = 0, len = cs.length; for(var i = 0; i < len; i++){ var c = cs[i]; if(!c.tpl){ c.tpl = new Ext.Template('{' + c.dataIndex + '}'); }else if(typeof c.tpl == 'string'){ c.tpl = new Ext.Template(c.tpl); } c.align = c.align || 'left'; if(typeof c.width == 'number'){ c.width *= 100; allocatedWidth += c.width; colsWithWidth++; } } // auto calculate missing column widths if(colsWithWidth < len){ var remaining = len - colsWithWidth; if(allocatedWidth < 100){ var perCol = ((100-allocatedWidth) / remaining); for(var j = 0; j < len; j++){ var c = cs[j]; if(typeof c.width != 'number'){ c.width = perCol; } } } } Ext.ListView.superclass.initComponent.call(this); } });
-
12 Feb 2010 10:20 AM #32
SQLite ux - Consideration
SQLite ux - Consideration
Hello Makana,
I'm slowly going through the new air-debug you provided. I just want to know if this includes your version of Ext.ux.SQLite....... such as the Ext.ux.SQLiteView, Ext.ux.SQLiteStore, Ext.ux.SQLiteProxy?
Basically, the 'viewName' param, the 'conn' param etc.
If not I would suggest you add it to this air-debug. I have a feeling that the air support will not be so heavy that we could not keep a general copy for the few followers of this forum.
Thanks
-
12 Feb 2010 10:30 AM #33
For me it is not possible to create tables anymore oO
I get following error:Code:this.connection = new Ext.sql.AirConnection(); this.connection.open(file); this.db = new Ext.sql.SQLiteStore({ conn: this.connection, autoLoad: true, key: 'ID', tableName: 'Tbl', fields: [...], api: { read: true, create: true, update: true, destroy: true } });
After debugging it, I found out, that the table "Tbl" is not created. It does also not work with the "normal" way using the dbfile...ReferenceError: Error #1056: Property stackTrace in flash.errors.SQLError could not be created.
at app:/lib/ext/ext-all-debug.js : 33204
at app:/lib/ext/adapter/ext/ext-base-debug.js : 920
undefined at undefined : undefined
-
12 Feb 2010 10:42 AM #34
Okay - I found the problem:
I think this should be set to true by default! When a user changes to this adapter, he doesn't have this property setCode:createTable: true

-
12 Feb 2010 11:34 AM #35
SQLite - Clauses
SQLite - Clauses
Hello Pranke,
Thanks for this. I've updated my air-debug to reflect your observation.
Can you tell me if you ever got the 'WHERE' clause working in the SQLite Store definition?
Basically, I have the following, but cannot and cannot get it to work. Been working on thsi for about 3 days, and nothing - maybe there is a bug:
Any thoughts or assistance would be MOST welcome.Code:new Ext.sql.SQLiteStore({ conn: iApplication.module.DB ,key: 'instance_id' ,tableName : 'ORI_DATABASES' ,fields: [ {name: 'id', type: 'int', mapping: 'INSTANCE_ID'} ,{name: 'text', type: 'string', mapping: 'INSTANCE_NAME'} ] ,autoload:true ,params: { where: 'where INSTANCE_NAME = ?' ,args: 'MYDB' } ,sortInfo:{field:'text', direction:'ASC'}
Thanks
Jack
-
12 Feb 2010 11:42 AM #36
Why don't you use the Store filter function?
-
12 Feb 2010 11:54 AM #37
Hello Pranke,
I haven't thought of using the Store filter at all. I will try out an dsee what I can come up with.
But managed to fix it. For some reason I was just doing something stupid and was not realizing that I WAS NOT PUTING baseParams in quotes. Ahh, I'm such a id....
Thanks JackCode:,baseParams: { 'where': 'where INSTANCE_NAME = ?' ,'args': ['CFINPROD'] ,'dir': 'ASC' }
-
14 Feb 2010 10:39 AM #38
Hey guys... so much discussion at the weekend....

Ok, I will try to answer everything:
@Pranke01:
Using SQLiteStore's "conn" property as mentioned in post 29 is the right way to do it. It will allow you only to open one database connection for the whole app and use it in all stores.
I will change line 1610 to ensure backwards compat for the createTable thing.
Using a filter on stores isn't always the way to do, because sql queries can return a huge amount of data. Do you really want to request all the data if you only need a hand full of recordsets?
@Jack_S
Doing the ListView stuff is not necessary since the ListView behavior was changed from version to version by the ExtJS team. I've realized the behavior of ExtJS3.1.1 as it works in browsers. I changed all the XTtemplate statements to Template statements. It's already done in lines 784 to 875.
The Ext.ux.SQLite... stuff is not necessary anymore, too. The proxy updates are inside Ext.sql.Proxy and views are to be specified with property "tableName", too, since in my Ext.ux.SQLite stuff a view is the same like a table. Either you can make your view readonly by configuring your store
or you can DO inserts, updates and deletes to a view and you have to make it possible with database triggers.Code:api: {create:false,update:false,destroy:false}
I don't think, it's due to quoted properties. I think, it's more because your "args" property is an array, not a string.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
-
16 Feb 2010 3:41 AM #39
Extend SQLite class - consideration
Extend SQLite class - consideration
Hello Makana,
Thank you for the update. Much much appreciated. I would like to maybe ask whether or not my implementation of the following is done correctly. Being a database administrator, I much rather write up the SQL and use where, args, dir , sort etc.
http://www.extjs.com/forum/showthread.php?t=55024
Thanks for the comments, and I think this would not be bad to have all together since it allows certain flexibility.Code:if(this.fireEvent("beforeload", this, params, reader, callback, scope, arg) !== false){ var clause = params.where || '', args = params.args || [], group = params.groupBy, sort = params.sort, dir = params.dir, sqlStr = params.sqlStr || '', strt = params['start'], limit = params.limit, countClause = ' ' + clause, rs; if(group || sort){ clause += ' ORDER BY '; if(group && group != sort){ clause += group + ' ASC, '; } clause += sort + ' ' + (dir || 'ASC'); } if (sqlStr !== ''){ rs = this.conn.query(sqlStr); } if (limit) { clause += ' LIMIT '; if (strt) clause += strt+','; clause += limit; rs = {}; rs[reader.meta.root] = this.table.selectBy(clause, args); rs[reader.meta.totalProperty] = this.conn.query('SELECT count(*) as count FROM ' + this.table.name + countClause)[0].count; } else rs = this.table.selectBy(clause, args); this.onLoad({callback:callback, scope:scope, arg:arg, reader: reader}, rs);
Thnaks
Jack
p.s - awesome work with the SQLite in ExtJs/Air.
-
16 Feb 2010 4:26 AM #40
What should be done? You would like to add a whole sql query string to the params and execute it, if it is set? otherwise build the string out of the args?
I would do it apart the other stuff, since it isn't needed then...
Code:if(this.fireEvent("beforeload", this, params, reader, callback, scope, arg) !== false){ params = params || {}; var rs = {}; if (Ext.isEmpty(params.sqlStr)) { var clause = params.where || '', args = params.args || [], group = params.groupBy, sort = params.sort, dir = params.dir, strt = params['start'], limit = params.limit, countClause = ' ' + clause; if(group || sort){ clause += ' ORDER BY '; if(group && group != sort){ clause += group + ' ASC, '; } clause += sort + ' ' + (dir || 'ASC'); } if (limit) { clause += ' LIMIT '; if (strt) clause += strt+','; clause += limit; rs[reader.meta.root] = this.table.selectBy(clause, args); rs[reader.meta.totalProperty] = this.conn.query('SELECT count(*) as count FROM ' + this.table.name + countClause)[0].count; } else rs = this.table.selectBy(clause, args); } else rs = this.conn.query(params.sqlStr); this.onLoad({callback:callback, scope:scope, arg:arg, reader: reader}, rs); }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


Reply With Quote