How can that happen?
I dynamically switch the itemDataSource of a LV like this:
this.viewModel.bind('dataSource', function() {
var listView;
listView = document.getElementById('itemList').winControl;
if (_this.viewModel.groupingCriterion === 'None') {
WinJS.UI.setOptions(listView, {
itemDataSource: _this.viewModel.dataSource,
oniteminvoked: _this.documentItemInvoked,
itemTemplate: doo.ui.renderers.documentItemRenderer,
selectionMode: 'multi'
});
} else {
WinJS.UI.setOptions(listView, {
itemDataSource: _this.viewModel.dataSource,
itemTemplate: doo.ui.renderers.filterGroupItemRenderer(_this.viewModel.groupingCriterion),
oniteminvoked: _this.groupItemInvoked,
selectionMode: 'none'
});
}
});
during the setOptions call the LV itemdata manager release() is called and in turn wants to call _releaseBinding on the datasource.
My datasource is either a BindingList or a custom datasource modeled after the Bing custom datasource sample (VirtualizedDataSource).
Is switching datasources not allowed when the LV has been already populated?