EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: federico on June 01, 2020, 02:59:14 AM



Title: combo reload at runtime
Post by: federico on June 01, 2020, 02:59:14 AM
Hi I would like to make a "classic" form where depending on the choice of a combo (that contains for example provinces...) I need to load a second combo with the appropriate json file with the cities in the province.. for example opening depening on the name of the choiced province. What's the better way ?

Federico


Title: Re: combo reload at runtime
Post by: jarry on June 03, 2020, 07:53:53 PM
Create a province combobox component and a city combobox component. Listen to the 'onChange' event on the province component and load new data for the city component. The code looks like this:
Code:
<input id="province" class="easyui-combobox" data-options="onChange:onProvinceChange>
<input id="city" class="easyui-combobox">
<script>
function onProvinceChange(value){
   $('#city').combobox('loadData', ...);
   // or $('#city').combobox('reload', ...);
}
</script>