my.multiLevelSelect provides a cascade selection function, mainly used for selecting several levels of associated data, such as province, city, and district. Users can drill down through hierarchical options to make their selection.
function openMultiLevelSelect() {
my.multiLevelSelect({
title: 'Cascade selector',
list: [
{
name: "City",
subList: [
{
name: "District A",
subList: [
{
name: "Street A"
},
{
name: "Street B"
}
]
},
{
name: "District B",
subList: [
{
name: "Street C"
},
{
name: "Street D"
}
]
}
]
}
],
success: (res) => {
my.alert({
title: JSON.stringify(res)
});
}
});
}
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Required | Description |
|---|---|---|---|
title | String | No | Title. |
list | JsonArray | Yes | Selection data list. |
name | String | Yes | Entry name. |
subList | JsonArray | No | Sub-entry list. |
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call success or failure). |
The incoming parameter is of the Object type with the following attributes:
| Property | Type | Description |
|---|---|---|
success | Boolean | Selection completed or not, returning false for cancellation. |
result | JsonArray | Selection result, such as [{"name":"City"},{"name":"District A"},{"name":"Street A"}]. |
list parameter defines the hierarchical structure of selectable itemssubList array containing child itemssuccess: false in the callback