MUI Linkage selection initialization Many people have problems, that is, setselectedvalue is not good, in fact, this place should be a bug
So we can only use setSelectedIndex to achieve
Below I is my realization way for everybody to refer:
<script> (function($, doc) {$.init (); $.ready (function() { //----------------------------------------- ////Cascading example varCityPicker3 =New $. Poppicker ({layer:3 }); Citypicker3.setdata (CITYDATA3); citypicker3.pickers[0].setselectedvalue (130000); varShi=citypicker3.getselecteditems () [0].children; varval_shi=130200; varval_xian=130204; for(vari=0;i<shi.length;i++) { if(shi[i].value==Val_shi) {citypicker3.pickers[1].setselectedindex (i); varxian=Shi[i].children; for(varj=0;j<xian.length;j++) { if(xian[j].value==Val_xian) {citypicker3.pickers[2].setselectedindex (j); } } } }
//Citypicker3.pickers[1].setselectedindex (2); //Citypicker3.pickers[2].setselectedindex (3); //Citypicker3.pickers[1].setselectedvalue (130205); varShowcitypickerbutton = Doc.getelementbyid (' ShowCityPicker3 ')); varCITYRESULT3 = Doc.getelementbyid (' CITYRESULT3 ')); Showcitypickerbutton.addeventlistener (' Tap ',function(event) {Citypicker3.show (function(items) {Cityresult3.innertext= "The city you selected is:" + (Items[0] | | {}). text + "" + (Items[1] | | {}). text + "" + (Items[2] | |{}). text; //returns False to prevent the selection box from closing //return false; }); }, false); }); }) (MUI, document); </script>
View Code
Hbuilder MUI Selector (picker) Set default options