set input value in template

2 posts, 0 answers
  1. Maxi
    Maxi avatar
    1 posts
    Member since:
    Sep 2012

    Posted 04 Dec 2012 Link to this post


    I have a doubt...

     it's possible use a methdo to get the value inside an input ... i mean:
    <script id="ReadOnlyText-template" type="text/x-kendo-template">
        ${name}<input type="text" disabled="disabled" data-bind="value:replaceString(value)"></input>


    <script id="ReadOnlyText-template" type="text/x-kendo-template">
        ${name}<input type="text" disabled="disabled" data-bind="value:value"></input>

    <script type="text/javascript">
        function replaceString(value) {
            if(typeof value == 'number' && value !== undefined) {
                return kendo.toString(value, "n2");
            } else {
                return value;

  2. Alexander Valchev
    Alexander Valchev avatar
    2873 posts

    Posted 05 Dec 2012 Link to this post

    Hi Maxi,

    This is not possible, because Kendo MVVM bindings are not JavaScript - you cannot call a function and pass parameter to it. 
    If a value from the View-Model requires processing before displaying it in the View a method should be created and used instead.
    For more information please check this topic.

    Kind regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top