PDA

View Full Version : AutoSuggest



djohns2
4 Dec 2009, 2:44 PM
I am using 'transform' on an existing select to get an autosuggest, ala the example. Works OK, but not until after I submit once. Initially it is just generic text boxes. They populate fine and when I submit the first request it comes back as a nice ExtJS autosuggest combo. Here is the .js file. Not much to it...




Ext.onReady(function(){


var selectItems = new Ext.form.ComboBox({

typeAhead: true,
triggerAction: 'all',
emptyText:'Enter item ...',
transform: 'item_id',
forceSelection:'true',
hiddenName: 'item_id',
valueField:'commissary_good_id'


});


var selectNames = new Ext.form.ComboBox({

typeAhead: true,
triggerAction: 'all',
emptyText:'Enter name...',
transform: 'booking_id',
forceSelection:'true',
hiddenName: 'booking_id',
valueField:'booking_id'

});

});


What am I missing? Something pretty basic, I bet!

Thanks

Doug

Condor
5 Dec 2009, 3:50 AM
Your code should work...

Just a few notes:
1. forceSelection is a boolean config option (not a string)
2. You don't need to specify a hiddenName (it will use the name of the transformed select tag)
3. You can't specify the valueField when transforming.

djohns2
5 Dec 2009, 2:11 PM
Thanks for the reply! One of those config settings couldn't be causing my problem...could it? As I noted it works, but the first time you open the page you see regular html textboxes. The Ext formatting doesn't seem to activate until after the submit. Then everything is nice and Ext looking. Hmmm.

Doug

djailer
8 Dec 2009, 10:49 AM
When I add variables to the page address Ext seems to load up OK. It is only when I submit the page itself - without any parameters- that it defaults to the generic html textboxes. I.E. ...mypage.cfm. If I submit ...mypage.cfm?item_id=1&booking_id=2 the EXT autosuggest is there and works great!

I am using EXT 2.2, in case that makes a difference. Happens in both IE and FF.

Doug

Condor
8 Dec 2009, 1:13 PM
IIRC Ext 2.2 had a broken Ext.onReady method.

Search the 2.x Bugs forum for the fix...