PDA

View Full Version : Multiselect problem



ipreti
30 Sep 2009, 11:27 AM
Hi guys,
When i try to load my multiselects on form.load() function im getting the following error message in firebug console:




this.view is undefined
anonymous("5")MultiSelect.js (line 258)
anonymous(Object template_Structure_Id=7)ext-all-debug.js (line 56545)
anonymous(Object tId=10 status=200 statusText=OK)ext-all-debug.js (line 59147)
handleResponse(Object tId=10 status=200 statusText=OK)ext-all-debug.js (line 8550)
f(Object conn=XMLHttpRequest tId=10, Object scope=Object argument=Object timeout=30000, Object name=r, Object name=q)ext-base.js (line 7)
anonymous()ext-base.js (line 7)


chrome://firebug/content/blank.gif this.view.clearSelections();\n

This is related to this part of multiselect code that is called by form.load() function:



setValue: function(values) { 256 var index;
257 var selections = [];
258 this.view.clearSelections();
259 this.hiddenField.dom.value = '';
260
261 if (!values || (values == '')) {
262 return;
263 }
264
265 if (!Ext.isArray(values)) {
266 values = values.split(this.delimiter);
267 }
268 for (var i=0; i<values.length; i++) {
269 index = this.view.store.indexOf(this.view.store.query(this.valueField,
270 new RegExp('^' + values[i] + '$', "i")).itemAt(0));
271 selections.push(index);
272 }
273 this.view.select(selections);
274 this.hiddenField.dom.value = this.getValue();
275 this.validate();
276 }
The weird part is... every time i use the debug mode of firebug i dont get this message, in another words, it works properly!.
But if i try to call the form normally, it doesnt work.

My multiselect uses a static store and the code is like this:




var dayofweekselector = {
xtype: 'multiselect',
height: 200,
name: 'dayOfWeek',
bodyStyle: 'padding-left:5px;',
tbar:[{
text: 'Days of Week',
handler: function(){
form.getForm().findField('dayOfWeek').setValue('2,3');

}
}],

store: [
['1', '01'], ['2', '02'], ['3', '03'], ['4', '04'], ['5', '05'],
['6', '06'], ['7', '07']]
};


When I try to load this multiselect i call my action that answers a json containing '2,3' as value for a dayOfWeek field..
I know that its working because the setValue function is correctly called.

Does someone know the answer for this? This is driving me crazy.
I think it is something related to assincronous call or smth like that.. because it seems that when i'm in debug mode the variable 'this.view' might've already been initialized, i dont know..
Thanks in advance.
Ivan.

hadi78
14 Oct 2009, 1:33 AM
i have the same problem, there must be a bug somewhere in the multiselect extension i guess :(

BigTitus
14 Oct 2009, 2:08 AM
Same problem here. :-(

hadi78
14 Oct 2009, 2:19 AM
this is really strange :(

i have my multiselect boxes in different tabs in a tabspanel. i have to click on each tab so that the view problem dosen't occur anymore. I tried to achieve the same in my code (to activate all tabs one by one to fake a click) , but had no luck yet.

ipreti
14 Oct 2009, 4:13 AM
Hi guys..
I solved this problem going through the tab that contains the multiselect before load and changing to the first one just after this event.
I think it is a bug as well..
good luck.

hadi78
14 Oct 2009, 4:28 AM
could you post the relevant code parts? i am not sure i understood you right, thx.

ipreti
14 Oct 2009, 4:48 AM
When you create your TabPanel define the activeTab being the one that contains your multiselect:



var tabs = new Ext.TabPanel({

activeTab:1
});



As you can see, in my case it was tab 1.
After that, on success load event, you can change to the desired activeTab as following:


success: function(records,o,s){
form.findById("tabs").setActiveTab(0);
}


I think that if you have more than one tab that contain multiselects, you've got to load it from diferent actions (diferent load events..) defining the activeTab as being the one that contain the multiselect that you are loading at that time...
As I said.. I'm pretty sure it is a bug and that's just a way to work it around.

Bdfy
16 Oct 2009, 6:06 AM
d my multiselects on form.load() function im getting the following error message in firebug console:

http://ibpro.com.ua/blog/2009/10/8/175-extjs-nekotorye-bagi-komponenta-multiselect-i-ix-ispravleniya/