This is a migrated thread and some comments may be shown as answers.

Visible Binding on Function

1 Answer 56 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 18 Nov 2013, 04:01 PM
i Kendo Team

we have a viewmodel with a list of child records (bound with a template). To show and hide child records we use a function like the following:

Function;
        Visible: function (e) {
            if (this.parent().parent().get("DebitorFilter") == null || this.KUNNR == null)
                return true;
            else
                return this.parent().parent().get("DebitorFilter") == this.KUNNR;
        }
Binding: "<div class="LabelDetailTemplate" data-bind="visible: Visible">"

So far it's working as expected when adding new records, but if property KUNNR changes in the parent object the visible function of the child records is not called again and the items stays hidden.
What are we doing wrong or do we have to create a property "visible" and refresh it manually when the KUNNR has changed?

Thanks in advanced and best regards
Daniel

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 20 Nov 2013, 08:17 AM
Hello Daniel,

In case you expect changes in the KUNNR property, you should use the get("KUNNR") syntax for it, in order for the binding to determine its dependencies correctly.

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MVVM
Asked by
Daniel
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or