2017-12-20 8 views

答えて

0

集中的な調査の後、手動で使用する必要があります。

  1. はちょうどあなたが使用しているものは何でも「検索」または「コンテンツ検索」フォルダからデフォルトの「group_xxx.html」を取る、グループ表示テンプレートファイルを作成します。

  2. コピーをダウンロードするか、WebPart(エクスポート)を検索し、 "GroupTemplateId"の値をグループJSファイルに変更する必要があります。 ResultTablesオブジェクト

最終コード

ctx.ClientControl.set_groupTemplateId('~sitecollection/_catalogs/masterpage/display templates/content web parts/Group_Content_QA.js'); 
ctx.ListDataJSONGroupsKey = "ResultGrouped" 
ctx.ListData.ResultGrouped = []; 

//function to create the ResultTables fake array 
function createResultGroup(items){ 
return { 
    ResultRows: items, 
    RowCount: items.length, 
    TableType: "RelevantResults", 
} 
}; 

//just a ref 
var _items = ctx.ListData.ResultTables[0].ResultRows; 

//categories dictionary 
var _groupDictionary = {}; 

//populating dictionary categories 
_items.forEach(function(e) { 
    if (!_groupDictionary[e.QACategoryOWSCHCS]){ 
    _groupDictionary[e.QACategoryOWSCHCS] = []; 
    } 
}); 

//populating dictionary categories with items 
_items.forEach(function(e) { 
_groupDictionary[e.QACategoryOWSCHCS].push(e); 
}); 

//adding to ctx categories as a named array 
ctx.groupsNames = Object.keys(_groupDictionary); 

//populating fake ResultTables array (ResultGrouped) 
ctx.groupsNames.forEach(function(g) { 
ctx.ListData.ResultGrouped.push(
    createResultGroup(_groupDictionary[g]) 
); 
}); 

read more here

を模倣するためのオブジェクトコード

  • 関連する問題