PDA

View Full Version : ComboBox item pre-selected



Preston85
6 Aug 2009, 12:57 AM
Hi, I think this is probably a simple issue but haven't been able to find an answer using search.

I have a form i'm using for editing details, I am loading data into the form by using:

Ext.getCmp('edit_task_form').getForm().load({
url : './task/assets/fnc/get_task.php',
params : {idtask : idtask}
});

The textfield/datefield's display the record correctly appart from the 'combo'. It is loaded from a store correctly but does not have its value selected. What is the method for doing this? If there's a up-to-date example i've missed could you point me in its direction.

Thanks.

Condor
6 Aug 2009, 1:04 AM
1. Is the combobox store loaded? If not, you could use this patch (http://extjs.com/forum/showthread.php?t=75751).
2. Is this a mode:'local' + triggerAction:'query' combobox? In that case you need to clear the combobox store filter before loading the store.

Preston85
6 Aug 2009, 1:34 AM
1. Is the combobox store loaded? If not, you could use this patch (http://extjs.com/forum/showthread.php?t=75751).
2. Is this a mode:'local' + triggerAction:'query' combobox? In that case you need to clear the combobox store filter before loading the store.

The store is loaded when the site is initialized, the form isn't displayed in its window until a its function is called. the combo doesn't appear to load as its options appear instantly.

I have not set a mode and the triggerAction is set to all.

Combo code:

{
xtype : 'combo',
fieldLabel : 'Assigned Staff Member',
name : 'users_idusers',
store : staff_store,
displayField : 'lname_user',
triggerAction : 'all',
valueField : 'idusers',
hiddenName : 'idusers',
lazyRender : false
}

Could it be the record i'm returning doesn't contain the correct field name? It returns users_idusers but not idusers...

Condor
6 Aug 2009, 1:37 AM
Are you sure the store is loaded (remember that loading is asynchronous)?

Preston85
6 Aug 2009, 1:54 AM
Are you sure the store is loaded (remember that loading is asynchronous)?

Ah my mistake, firebug shows the GET statement when I first open the page, I didn't notice it was doing the GET again when I click on the combo. What setting have I missed?

Condor
6 Aug 2009, 2:41 AM
You are manually loading the combobox store, so you can set mode:'local'.

Preston85
6 Aug 2009, 5:49 AM
Thanks for the help, the combo is now loading at the start and not everytime the box is clicked which is good. The final solution to my problem was i'd missed the 'id' value from my combo box.