my.multiLevelSelect

Cascade selection function, mainly used for selecting several levels of associated data, such as province, city and district.

Sample Code

copy
//.json
{
     "defaultTitle": "Cascade selector"
}
copy
<!-- .axml -->
<view class="page">
  <view class="page-description">Cascade selector API</view>
  <view class="page-section">
    <view class="page-section-title">my.multiLevelSelect</view>
    <view class="page-section-demo">
      <button type="primary" onTap="openMultiLevelSelect">Cascade selector</button>
    </view>
  </view>
</view>
copy
//.js
Page({
  openMultiLevelSelect() {
    my.multiLevelSelect({
        title: 'Cascade selector',//Cascade selector title 
        list: [
        {
            name: "City",//entry name
            subList: [
                {
                    name: "District A",
                    subList: [
                        {
                            name: "Street A"
                        },
                        {
                            name: "Street B"
                        }
                    ]
                },
                {
                    name: "District B",
                    subList: [
                        {
                            name: "Street C"
                        },
                        {
                            name: "Street D"
                        }
                    ]
                }
            ]// cascade sub-data list
        }],// Cascade data list
        success:(res)=>{
            my.alert({title:JSON.stringify(res)})
        }
    });
  }
})

Parameters

The incoming parameter is of the Object type with the following attributes:

PropertyType

Required

Description
titleStringNoTitle.
listJsonArrayYesSelection data list.
nameStringYesEntry name.
subListJsonArrayNoSub-entry list.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

PropertyTypeDescription
successBooleanSelection completed or not, returning  false for cancellation.
resultJsonArraySelection result, such as [{"name":"City"},{"name":"District A"},{"name":"Street A"}].