1. 程式人生 > >Ext 重新載入Combobox的資料

Ext 重新載入Combobox的資料

<textarea cols="50" rows="15" name="code" class="javascript">function initFlushTime() { var datasource = new Ext.data.Store({ proxy : new Ext.data.HttpProxy({ url : 'jsp/cache/write/flushTime.jsp?id=1' }), reader : new Ext.data.JsonReader({}, ['value', 'text']) }); datasource.load(); var flushCombobox = new Ext.form.ComboBox({ store : datasource, width : 153, valueField : 'value', displayField : 'text', typeAhead : true, mode : 'local', triggerAction : 'all', emptyText : '-請選擇-', selectOnFocus : true, applyTo : &quot;flushtime&quot; }); var fatjames = Ext.get(&quot;unit_flush&quot;); fatjames.on(&quot;change&quot;, function() { flushCombobox.reset(); datasource.proxy = new Ext.data.HttpProxy({ url : 'jsp/cache/write/flushTime.jsp?id=' + fatjames.dom.value }); datasource.load(); }); }</textarea>