Window MVVM title

4 posts, 1 answers
  1. Andrew
    Andrew avatar
    4 posts
    Member since:
    Jun 2012

    Posted 01 Aug 2013 Link to this post


    I'm  wondering if the window title can be bound to a view model, so it can be modified via the view model at run time. Currently I have data-title set in the html, but I would like to be able to change the title via the view model (presumably in the data-bind section).
    <div id="window1" data-role="window" data-resizable="false" data-modal="true" data-title="windowTitle1" data-bind="invisible: vmInvisible" data-width="300"><br></div>
    Can the title be modified in a vew model, or can it only be set via the title() method?
    var kendoWindow = $("#window").data("kendoWindow").title("Do a barrel roll!");
    I tried using data-bind="attr: {title: windowTitle2 }" but this doesn't work on window, is there another way of doing it?

  2. Answer
    Alex Gyoshev
    Alex Gyoshev avatar
    2527 posts

    Posted 05 Aug 2013 Link to this post

    Hello Andrew,

    I'm afraid that this binding is not supported on the window widget at this moment. You can, however, bind an event handler and handle the setting of this value, like shown in this jsBin.

    Alex Gyoshev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Steven
    Steven avatar
    4 posts
    Member since:
    Jul 2014

    Posted 02 Sep 2014 Link to this post

    Its a year later, but for anyone else looking for an answer.  Here's a way that worked for me.  This may only work for me because my window was a part of a template, but you can bind the text using the #:field# syntax... so for example this worked:

    <div  class="hierarchyWindow"
             data-bind="visible: WindowVisible"
  4. Tim
    Tim avatar
    4 posts
    Member since:
    Oct 2012

    Posted 12 Mar 2015 Link to this post

    The jsBin quoted by Telerik shows a way to create a window with the title, but my goal was to update the title based upon a bound element.  I can't tell if Steven's answer serves this purpose because I am not creating my window from a template.  I cobbled this together and it seems to work nicely.

                                var dataItem = $('#cFoo', this.element)[0].kendoBindingTarget.source;
                                var tHis = this;
                                dataItem.bind('set', function (pEvent) {
                                    if (pEvent.field == 'Foo')
                                        tHis.setOptions({ title: 'Editing ' + pEvent.value });

    I put this code into the activate function for a grid's popup editor window.  The cFoo element is data bound to the Foo member like so:             <input type="text" name="Foo" id="cFoo" data-bind="value:Foo">

Back to Top