importClass(Packages.tornaco.apps.shortx.core.proto.action.ShowListDialog);
importClass(Packages.tornaco.apps.shortx.core.proto.action.ShowListDialogDataType);
importClass(Packages.tornaco.apps.shortx.core.proto.common.DialogUiStyleSettings);

var dataJson = `[
    {
        "name": "Android",
        "version": 16,
        "__value": "android",
        "__icon": "android-fill"
    },
    {
        "name": "Ubuntu",
        "version": 24,
        "summary": "Ubuntu is the modern, open source operating system on Linux for the enterprise server, desktop, cloud, and IoT.",
        "__value": "ubuntu",
        "__icon": "ubuntu-fill"
    }
]`;

// ShowListDialog Action
var action = ShowListDialog.newBuilder()
    .setTitle("choose")
    .setData(dataJson)
    .setDataType(ShowListDialogDataType.ShowListDialogDataType_Json)
    .setStyle(
        DialogUiStyleSettings.newBuilder()
            .setFontScale(1.0)
            .build()
    )
    .setIsMultipleChoice(true)
    // Show bottom OK button
    .setNeedConfirmAction(true)
    // Support multiple selection
    .setCancelable(true)
    // Can it be cancelled
    .build();

var result = shortx.executeAction(action);

result.contextData.get("selectedListItem");
 
 
Back to Top