Question

Issue example jsFiddle

Problem:
If !!$data.Visible() == false then it throws this error

Error:

Uncaught TypeError: Cannot read property '__ko__1380676672381' of null knockout-2.3.0.debug.js:578

Error occurs here:

getAll: function (node, createIfNotFound) {
            var dataStoreKey = node[dataStoreKeyExpandoPropertyName];

Code:

<!-- ko if: !!$data.Visible() -->
    <div class="row-column" data-bind="text: $parent[$data.Key], attr: { style: 'width: ' + $data.Width() + 'px' }"></div>
<!-- /ko -->
Was it helpful?

Solution

Edit:

My previous answer was incorrect because the sortable binding needs to be able to update the array. So the solution instead is to not use a virtual element for the if binding.

<div data-bind="if: $data.Visible()">
    <div>Im visible</div>
</div>

http://jsfiddle.net/mbest/5TJ2f/6/

References: https://stackoverflow.com/a/14219177/1287183, https://github.com/rniemeyer/knockout-sortable/issues/58

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top