PDA

View Full Version : Event handling: Better way of doing this?



Wolfgang
26 Jan 2007, 2:37 PM
Hello,

i need to get an onchange event trigger a callback that sets a filter for my grid.



<form>
<select name="lastCalls" id="lastCalls">
<option value="1h">1 Hour</option>
<option value="2h">2 Hours</option>
</select>
...
</form>
var callerList = new YAHOO.ext.grid.CallerListGrid(
'callerList', 'calls/resp_calls.php', 10
);

getEl('lastCalls').mon('change', function(e){
callerList.dataModel.setFilter(this.dom.options[this.dom.selectedIndex].value);
});


This works - But is there a better way of getting the value of the select box using yui-ext 0.33?

Wolfgang

tryanDLS
28 Jan 2007, 10:31 AM
That's how I do it - the only think to watch is when you might not have a selectedIndex, you'll have a problem b/c the index<0

jack.slocum
28 Jan 2007, 3:48 PM
Did you try this.dom.value?

tryanDLS
28 Jan 2007, 5:32 PM
Learn something new everyday - no idea that you could to that.