2017-04-07 93 views
0

我想在网格中显示列表视图的选定项目。所有选定的项目应显示在主页上。但我找不到办法。我重视弹出窗口的js文件的代码和截图获取选定项目的listview syncfusion

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

回答

0

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

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

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

问候,
阿伦P.