当我从右侧列表中的任何项目时,我想更新右侧listview
此外,当我单击选择所有项目以选择右侧列表项而不是左侧项目时。
换句话说,我想要做的是,当我单击左侧列表中的任何项目时,右侧列表将根据我调用的左侧项目更改为不同的列表
这是我的 JS 代码
function selectionChangedHandler() {
// Check for selection
var selectionCount = listView.selection.count();
if (selectionCount === 1) {
// Only one item is selected, show the message
// information for the item
listView.selection.getItems().done(function (items) {
// Print item data to the relevant message pane locations
inboxMessage_Text.innerText = items[0].data.text;
if (items[0].data.key == 1) {
document.getElementById('listView4b2')
.innerHTML = '<ol><li>html2222 data</li></ol>';
} else {
document.getElementById('listView4b2')
.innerHTML = '<ol><li>html data</li></ol>';
}
});
}
}
function selectAll() {
WinJS.log && WinJS.log(" ", "sample", "status");
listView.selection.selectAll();
}
function clearSelection() {
WinJS.log && WinJS.log(" ", "sample", "status");
listView.selection.clear();
}
和 HTML 代码
<div id="listView4b"
class="win-selectionstylefilled"
data-win-control="WinJS.UI.ListView"
data-win-options="{
itemDataSource: myToppingsData.dataSource,
itemTemplate: mediumListIconTextTemplate,
selectionMode: 'multi',
tapBehavior: 'toggleSelect',
layout: { type: WinJS.UI.GridLayout }
}"
></div>