EasyUI Forum
May 14, 2024, 06:45:03 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: combo reload at runtime  (Read 2825 times)
federico
Newbie
*
Posts: 6


View Profile
« 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
Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 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>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!