locked
this._dataSource._releaseBinding(this); in ListBinding throws when _releaseBinding is not defined

    Question

  • 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?

    Friday, October 12, 2012 10:23 AM

Answers

  • nevermind. Got it solved: The incoming datasource was a bound property, not properly unwrapped.
    • Marked as answer by phil_ke Monday, October 15, 2012 2:05 PM
    Monday, October 15, 2012 10:14 AM

All replies

  • nevermind. Got it solved: The incoming datasource was a bound property, not properly unwrapped.
    • Marked as answer by phil_ke Monday, October 15, 2012 2:05 PM
    Monday, October 15, 2012 10:14 AM
  • Just to clarify, in order to "unwrap" a bound property, use the backingData member on your property. So in this case:

    {
        ...
        itemDataSource: _this.viewModel.dataSource.backingData,
        ...
    }

    Tuesday, February 04, 2014 10:15 PM