-
21 Feb 2009 9:55 PM #1
combobox not working properly
combobox not working properly
Hi, i'm new in etxjs and i try to use combobox. This is my code:
and this is the html tag:Code:Ext.onReady(function(){ Ext.QuickTips.init(); var storeSQL2 = new Ext.data.Store({ reader : new Ext.data.JsonReader({fields: ['id_destino','destino'],root: 'data'}), proxy: new Ext.data.HttpProxy({url: './combos_presc.php',method: 'POST'}) }); storeSQL2.load(); var combo = new Ext.form.ComboBox({ store: storeSQL2, triggerAction: 'all', emptyText : 'Seleccione algo...', forceSelection: true, mode:'local', valueField: 'id_destino', displayField: 'destino', width:240, applyTo: 'ubic-actual' }); });
n th firebug i see the first load of the data but then the combo doesn't work when i click it.HTML Code:... <td align="left" class="td2"> <div> <input type="text" id="ubic-actual" size="45" style="height:18px" /> </div> </td> ...
Any suggestion.
thanks.
-
22 Feb 2009 2:17 AM #2
Try not to use applyTo; use renderTo:Ext.getBody() or renderTo:'an-empty-div-id' instead. Try first to render to body to test functionality of the combo itself and only then render it to an empty div.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
22 Feb 2009 5:51 AM #3
Hi and thanks for the answer. I use the sentence combo.renderTo:Ext.getBody('ubic-actual') outside the combo var and inside it. And in the navigator disappeared de combobox.
I changed it to applyTo and the comobobox appear.
The combo work fine now, but very slowly because the Store save 43000 record. How it make this transaction more fast?. Any idea.
thanks in advance
-
22 Feb 2009 6:38 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,170
- Vote Rating
- 33
Ext.getBody() returns document.body. just combo.render('someDiv')

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
22 Feb 2009 7:52 AM #5
});Code:Ext.onReady(function(){ Ext.QuickTips.init(); var storeSQL2 = new Ext.data.Store({ reader : new Ext.data.JsonReader({fields: ['id_destino','destino'],root: 'data'}), proxy: new Ext.data.HttpProxy({url: './combos_presc.php',method: 'POST'}) }); storeSQL2.load(); var combo = new Ext.form.ComboBox({ store: storeSQL2, triggerAction: 'all', emptyText : 'Seleccione algo...', forceSelection: true, mode:'local', valueField: 'id_destino', displayField: 'destino', width:240, renderTo: Ext.getBody() });Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
22 Feb 2009 7:53 AM #6
BTW, 43000 rows combo is useless: 1) it loads very slow and consumes too much resources and 2) user cannot digest that lot of records. Use paging combo with search instead.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
22 Feb 2009 4:01 PM #7
Thanks for the tips, but if i use pageSize to reduce the amount of records for the user, i must to use remote mode. This property does not allow the automatic search of the item combo. i'm right?
-
22 Feb 2009 4:21 PM #8
Not really. If you have a corresponding backend then search works is remote mode perfectly. Combo automatically sends value typed in the textbox, server returns matching records and then user can select. Go for it, it is worth to.
Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video
-
22 Feb 2009 4:34 PM #9
Sorry forgive me i'm insistent. The combo again not work. I clear cookies and this stuff but the load of it no work. I use renderTo: Ext.getBody('<id of div>') but the div appear in another place of the page and not render the result of the combo box. What i'n doing wrong?.
Thanks in advance.
-
22 Feb 2009 5:16 PM #10
Ext.getBody() doesn't take any argument. I've written that rendering into body element would be first step. If combo works, however rendered in the wrong place, then you change renderTo:'an-empty-div-id-to-render-the-combo-into'. If everything goes well, combo will correctly render in correct place.
BTW, have you read in docs what config option renderTo means? Also, what is Ext.getBody() and applyTo? If not, do it now. We can help you but you must read the docs yourself.Jozef Sakalos, aka Saki
A lot of valuable info at:
Saki's Extensions and Plugins
Saki's Extensions and Plugins Docs
Saki's Examples, Latest: Grid in Card Layout
Saki's Blog, Featured: Writing a Big Application in Ext, Latest: Grid MultiSearch Plugin Video


Reply With Quote