Hbuilder MUI Selector (picker) Set default options

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.