PDA

View Full Version : Form Expert?



kevinv1990
4 Jan 2011, 2:40 AM
Hello all,

Is it possible to create a dynamic form in sencha?

Let's say i have a dropdown, and when 1 value is chosen (all locations), i want that the slider which represent the distance from current location to the item is hidden, because all locations are showed of course, no need to specify a maximum distance.

Any chance this may work? I am thinking with a listener on the form, when value changes, the form update and components (which are first hidden), will be shown after.

Kevin

Stuart-SwarmOnline
4 Jan 2011, 3:09 AM
Use the Select field's 'change' event and check if the new value is the 'All Locations' value then hide the max distance slider. Something along these lines (completely untested!)




...
{
xtype: 'select',
options: [
...
],
listeners: {
change: function(select, value){
if(value === 'all locations'){
this.get(x).hide(); // get the max distance field and call hide() on it
} else {
this.get(x).show();
}
},
scope: this
}
}
...

kevinv1990
4 Jan 2011, 3:40 AM
well that is very nice !