【问题标题】:Get Selected Items of listview syncfusion获取 listview syncfusion 的 Selected Items
【发布时间】:2017-04-07 11:27:43
【问题描述】:

我想在网格中显示列表视图的选定项目。所有选定的项目都应显示在主页上。但我找不到这样做的方法。我附上了js文件代码和弹窗截图

var subItemsLoaded = false,
    SubItemSelectionModalId = '#subItemSelectionModal';
listViewHeight = 400,
subItemClicked = 0;

$(SubItemSelectionModalId).on('shown.bs.modal', function () {
    if (
        (window.selections.assetTemplate.id != null &&
        window.selections.assetTemplate.id != 0)) {
        $(SubItemSelectionModalId + ' .modal-body').ejWaitingPopup({
            showOnInit: true
        });
        $(SubItemSelectionModalId + ' .listViewItems').ejListView({
            "height": 400,
            "loadComplete": function () {
                repositionSearchBoxFor(SubItemSelectionModalId);
                var obj = $(SubItemSelectionModalId + ' .modal-body').data("ejWaitingPopup");
                console.log("12345.5");
                obj.hide();
                console.log("123456");
            },

            "mouseUp": function (e) {
            },
            "enableAjax": true,
            "enableCheckMark": true,
            "enableFiltering": true,
            "dataSource": ej.DataManager({
                "url": "/Shared",
                "cachingPageSize": 0,
                "timeTillExpiration": 0
            }),
            "query": ej.Query().from("GetSubItems").addParams("assetTemplateId", window.selections.assetTemplate.id).addParams("assetTemplateVariantId", window.selections.assetTemplateVariant.id),
            "fieldSettings": {
                "text": "SubItemName",
                "id": "SubItemId"
            }
        });
    }
});

$(SubItemSelectionModalId).on('hidden.bs.modal', function () {
    var listViewItems = $(SubItemSelectionModalId + ' .listViewItems');
    if (listViewItems.find('ul').length > 0) {
        var selections = $(SubItemSelectionModalId + ' .listViewItems').ejListView("getCheckedItems");
        if (selections.length > 0) {
            $('#selectedSubItems').html(selections.join(' , ')).removeClass('hidden');
        }
    }
});

enter image description here

【问题讨论】:

    标签: javascript listview syncfusion


    【解决方案1】:

    是的,可以在网格中显示列表视图的选定项目。为此,您必须使用 Listview 的 mouseUp 事件来获取列表中的选定项,然后将这些选定项作为 Grid 控件的数据源。

    此外,为了获取所选列表的 ID,您必须获取 ID 属性并获取其 ID 并将 ID 字段绑定为 Grid 控件的列之一。这样,您可以在 Listview 中获取特定列表的 ID,然后将其绑定到 Grid。

    我们还准备了一个样本供您参考:http://jsplayground.syncfusion.com/prahqy2i

    问候,
    阿伦 P.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-18
      • 1970-01-01
      • 2019-05-13
      • 2023-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多