PDA

View Full Version : as far as i can tell this should work. actually it used to.



xnakxx
30 Nov 2010, 3:45 PM
PMZ.Search = new Ext.form.FormPanel({
scroll: 'vertical',
items: [{
xtype: 'fieldset',
title: 'Choose your options...',
instructions: 'Please enter the information above.',
items: [{
xtype: 'select',
id: 'priceMin',
name: 'priceMin',
label: 'Min Price',
listeners: {
change: function(t,v){
if (parseInt(Ext.getCmp('priceMin').getValue()) > parseInt(Ext.getCmp('priceMax').getValue()))
{
Ext.getCmp('priceMax').setValue(parseInt(Ext.getCmp('priceMin').getValue())+50000);
}

}
},
options: [{
text: '$0',
value: '0'
},
{
text: '$50,000',
value: '50000'
}, {
text: '$100,000',
value: '100000'
},{
text: '$150,000',
value: '150000'
}, {
text: '$200,000',
value: '200000'
}, {
text: '$250,000',
value: '250000'
}, {
text: '$300,000',
value: '300000'
}, {
text: '$350,000',
value: '350000'
}, {
text: '$400,000',
value: '400000'
}, {
text: '$450,000',
value: '450000'
}, {
text: '$500,000',
value: '500000'
}, {
text: '$550,000',
value: '550000'
}, {
text: '$600,000',
value: '600000'
}, {
text: '$650,000',
value: '650000'
}]
},
{
xtype: 'select',
id: 'priceMax',
name: 'priceMax',
label: 'Max Price',
listeners: {
change: function(t,v){
if (parseInt(Ext.getCmp('priceMax').getValue()) < parseInt(Ext.getCmp('priceMin').getValue()))
{
Ext.getCmp('priceMin').setValue(parseInt(Ext.getCmp('priceMax').getValue()));
}

}
},
options: [{
text: '$50,000',
value: '50000'
}, {
text: '$100,000',
value: '100000'
},{
text: '$150,000',
value: '150000'
}, {
text: '$200,000',
value: '200000'
}, {
text: '$250,000',
value: '250000'
}, {
text: '$300,000',
value: '300000'
}, {
text: '$350,000',
value: '350000'
}, {
text: '$400,000',
value: '400000'
}, {
text: '$450,000',
value: '450000'
}, {
text: '$500,000',
value: '500000'
}, {
text: '$550,000',
value: '550000'
}, {
text: '$600,000',
value: '600000'
}, {
text: '$650,000',
value: '650000'
}]
}]
});
using alerts i can see the change event firing, i can also get the values of the selects but it silently ignores me when i try the setValue().
initially (past sencha touch version) i was listening to the "select" event but have since changed to the "change" event.

Animal
1 Dec 2010, 12:28 AM
Have you debugged?

xnakxx
1 Dec 2010, 12:43 AM
Other than the console in the developer tools with safari, no. I was not at my dev machine with the proper tools. I just wanted to throw it out there in the off chance someone else has ran into the issue. For now it's an upgrade to the latest ST js then I'll bear down and see what went wrong where.

xnakxx
1 Dec 2010, 12:49 AM
The console showed no errors btw

Animal
1 Dec 2010, 12:53 AM
Yes, but have you debugged?

ie, stepped into the setValue call and see what it does with the value?

xnakxx
1 Dec 2010, 9:29 AM
upgrading to 1.0.1 and or me using the newer xtypes fixed the logic issue somewhat.
I can't really tell from the docs but shouldn't setValue() on a selectfield set the value but also update the text associated to that value? As per my example above setValue() is setting the proper value of 100000 but also displaying 100000 not "$100,000".

ed.canas
8 Dec 2010, 8:18 AM
I had the same issue display issue where it would show the value instead of the selected text. Easily fixed by adding quotes to the value eg.. setValue('100000')