Kendo UI开发教程(18): Kendo MVVM 数据绑定(七) Invisible/Visible
Invisible/Visible绑定可以根据ViewModel的某个属性来显示/隐藏DOM元素。
例如:
1
<
div
id
=
"view"
>
2
<
div
data-bind
=
"invisible: isInvisible"
>some content
3
4
</
div
>
5
<
button
data-bind
=
"click: show"
>Show</
button
>
6
</
div
>
7
<
script
>
8
var viewModel = kendo.observable({
9
isInvisible: true,
10
show: function () {
11
this.set("isInvisible", false);
12
}
13
});
14
15
kendo.bind($("#view"), viewModel);
16
</
script
>