Jun 03, 2011, 4:45 PM
how to set combobox default value when page load in mvc?
<ext:ComboBox ID="cbWarehouseID" runat="server" FieldLabel="Warehouse" LabelWidth="20"
ValueField="WarehouseID" DisplayField="Name">
<Store>
<ext:Store ID="dsWarehouses" runat="server" AutoLoad="false">
<Proxy>
<ext:HttpProxy Url='/BaseInfo/GetWarehouseList/' />
</Proxy>
<Reader>
<ext:JsonReader IDProperty="WarehouseID" Root="data" TotalProperty="total">
<Fields>
<ext:RecordField Name="WarehouseID" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="Description" />
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name="limit" Value="30" Mode="Raw" />
<ext:Parameter Name="start" Value="0" Mode="Raw" />
<ext:Parameter Name="dir" Value="DESC" />
<ext:Parameter Name="sort" Value="WarehouseID" />
</BaseParams>
<SortInfo Field="WarehouseID" Direction="DESC" />
</ext:Store>
</Store>
<Listeners>
<AfterRender Handler="dsWarehouses.load();if (cbWarehouseID.store.getAt(0)){var firstValue =cbWarehouseID.store.getAt(0).get('Name');cbWarehouseID.setValue(firstValue)};" />
</Listeners>
</ext:ComboBox>
it does not work?please help me,thanks!