mvvmkendo-uikendo-template

Kendo function MVVM bind


I'm tried to use kendo function mvvm binding with constant like shown here: https://docs.telerik.com/kendo-ui/knowledge-base/mvvm-pass-parameters-from-view-to-view-model-function

<div data-bind="visible: visibleTextBox('2q4')"></div>

But if I add >2 arguments, or add dots into constant

<div data-bind="visible: visibleTextBox('2q4', '2q4', '2q4')"></div>
<div data-bind="visible: visibleTextBox('2.q.4')"></div>

It's return error:

result:4 Uncaught SyntaxError: Unexpected token }

Can someone tell, why does this happen, and how to fix this?

Here is dojo: https://dojo.telerik.com/iJAXajEg


Solution

  • The answer is straight up in the link at the beginning of your question:

    if you need to pass an array, pass it as a string with a certain delimiter.

    If you need a 2-dimentional array, use 2 delimiters:

    "1q3p2q4".split("p").map(x => x.split("q"))
    

    will give you:

    [[1, 3],[2, 4]]