Hi Friends !

Background :

We are creating an Adobe Air Offline Desktop Application (using Adobe Air 2.5 and Extjs 3.3.0 Air Pack). We enjoy using Extjs thus far.

We are using SQLite for datastorage.

We have a requirement to provide autocomplete for our combo boxes. The data for the combo boxes is to be derived from the local SQLite. Some of the combo boxes may contain 10,000 + records.

Current Implementation:


PHP Code:
conn = new Ext.data.SQLiteDB();
 
postcode Ext.data.Record.create([{
 
name'id'},
{
 
name'postcode'},
{
 
name'locality'},
{
 
name'state'},
{
 
name'current_as_of'},
{
 
name'last_updated'}]);
 
postcodeStore = new Ext.data.SQLiteStore({
 
autoLoadtrue,
 
autoCreateTablefalse,
 
fieldspostcode,
 
connconn,
 
tableName'tbl_postcode_localities',
 
idProperty'id'
});
 
// so we dont get crazy
postcodeStore.baseParams.limit 10;
 
postcodeStore.load();
air.Introspector.Console.info(postcodeStore);
 
new 
Ext.form.ComboBox({
 
storepostcodeStore,
 
fieldLabel'locality',
 
displayField'locality',
 
typeAheadtrue,
 
width250,
 
autoScrollfalse,
 
mode'local',
 
valueField'id',
 
triggerAction'all',
 
enableKeyEventstrue,
 
emptyText'Select a locality...',
 
loadingText'Searching...',
 
pageSize10,
 
totalProperty'totalCount',
 
hideTriggerfalse,
 
selectOnFocustrue,
 
minChars3,
 
forceSelectiontrue,
 
allowBlankfalse,
 
listeners: {
  
beforequery: function (qe) {
   
air.Introspector.Console.info(qe);
  }
 }
})
 
try {
 
conn.open('data/test.db');
 
air.trace("Database opened");
} catch (
err) {
 
air.trace("Database could not be opened");
 
air.trace(err.message);

//----------- // SNIP // --------------

// The SQLite table schema looks like this :

CREATE TABLE tbl_postcode_localities (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
postcode TEXT NOT NULL,
locality TEXT NOT NULL,
state TEXT NOT NULL,
current_as_of DATE,
last_updated DATE DEFAULT (datetime('now','localtime'))
)

Problem :

So ... we have a paging ComboBox (please see dropdown1.jpg , below).

dropdown1.JPG


This is great! We can select next page and only load X number of results from the database at any given time (please see screenshot 3, below).

dropdown3.JPG

However the issue we have is that the autocomplete only appears to allow for results within the current page of the result set (please see dropdown2.jpg). The database does not appear to be queried (or perhaps im not looking in the right spot) when the user types values in.

For example if I typed in a value of "lyons" it does not autocomplete the value of "LYONS" (which is within the second page of results).

dropdown4.JPG

However if I typing in "JIN", JINGILI is correctly autocompleted (as it occured in the current page of results).


dropdown2.JPG

Unfortunately it is an assumption of the application that we do not have access to a backend (eg we can not make ajax requests out to receive json results), all data must come from the local sqlite database.

I seek advise from the community as to how to achieve the situation where suggestion results can be dynamically retreaved from the local sqlite database as the user types in values (without loading all 10,000+ records).

I have been looking for a number of days without sucess for a solution to this query, thank you in advance for any time spent here it will be greatly appreciated.