2017-04-07 108 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.