AUCascadePicker provides a multi-level cascade selector that supports selection at a maximum of three levels.
Sample image

API description
public void setDateData(List<PickerDataModel> strList)
public void setSelectedItem(PickerDataModel model)
public void setOnLinkagePickerListener(OnLinkagePickerListener listener)
JSAPI description
API
antUIGetCascadePicker
API usage
AlipayJSBridge.call('antUIGetCascadePicker',
{
title: 'nihao',
selectedList:[{"name":"Hangzhou",subList:[{"name":"Shangcheng District"}]}],
list: [
{
name: "Hangzhou",
subList: [
{
name: "Xihu District",
subList: [
{
name: "Gucui Street"
},
{
name: "Wenxin Street"
}
]
},
{
name: "Shangcheng District",
subList: [
{
name: "Yan'an Street"
},
{
name: "Longxiangqiao Street"
}
]
}
]
}
]
},
function(result){
console.log(result);
});
Input parameters
Name | Type | Description | Required | Default value | Version |
Name | Type | Description | Required | Default value | Version |
---|
title | String | The cascade control title. | No | - | 10.1.2 |
selectedList | JSON | Selected state, specifying the selected sub-item and in a format the same as that of the input parameter ([{“name”:”Hangzhou City”,subList:[{“name”:”Shangcheng District”}]}]) | No | - | 10.1.2 |
List | JSON | The selector data list. | Yes | - | 10.1.2 |
name (a name in a list) | String | The entry name. | Yes | - | 10.1.2 |
subList (a sublist in a list) | JSON | The sub-entry list. | No | - | 10.1.2 |
fn | function | The callback function after selection is complete. | No | - | 10.1.2 |
Output parameters
Name | Type | Description | Version |
Name | Type | Description | Version |
---|
success | bool | Whether selection is complete. If selection is canceled, false is returned. | 10.1.2 |
result | JSON | The selection result, for example, [{"name":"Hangzhou City",subList:[{"name":"Shangcheng District"}]}] . | 10.1.2 |
Sample code
AUCascadePicker datePicker = new AUCascadePicker(PickerActivity.this);
datePicker.setDateData(datas);
datePicker.setOnLinkagePickerListener(new AUCascadePicker.OnLinkagePickerListener() {
@Override
public void onLinkagePicked(PickerDataModel msg) {
PickerDataModel model = msg;
AuiLogger.info("onLinkagePicked", "onLinkagePicked:"+msg.name+ model);
StringBuilder sb = new StringBuilder();
while (msg != null){
sb.append(msg.name+" ");
if(msg.subList != null && msg.subList.size() > 0) {
msg = msg.subList.get(0);
}else {
msg = null;
}
}
box3.getInputEdit().setText(sb);
}
});
datePicker.show();