Bindings doesn't works in header template of kendo grid

3 posts, 1 answers
  1. Alexander
    Alexander avatar
    4 posts
    Member since:
    Aug 2012

    Posted 28 Jun 2013 Link to this post

    Hello,

    I am using Kendo UI Web v2013.1.614 release with jQuery 1.9.1 and i have problems with header template in kendo grid.
    Here is declaration of grid:
    <div         data-role="grid"
     data-sortable="true"
     data-scrollable="false"
     data-sortable="{ allowUnsort: false }"
     
    data-pageable="{ info: false }"                
     data-bind="source: drivesSource"
     data-columns='[
        {"field": "selected", "title": " ", "width": "auto", "sortable":false,
           "template": "#=runTemplate(\"drive-select-template\", data)#",
           "headerAttributes": {style: "text-align: right"},
           "headerTemplate": "<input data-bind=\"checked: parent().parent().checkAll\" class=\"grid-checkbox\" type=\"checkbox\" title=\"@Localization.Tooltips.Select_all\" />"} .....                  
                  
    ]'>
                </div>

                        
    The first problem i faced was that all templates stuff like '#=runTemplate()#' and so on doesn't work in header template. In item template it works ok.
    So i declared inline template for header but haven't succeeded in binding it to something.
    I tried several context like parent(), parent().parent(), $root and some custom bindings but nothing worked, looks like this is bug.

    Best regards,
    Alexander
  2. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 01 Jul 2013 Link to this post

    Hello Alexander,

    By default the Grid's header will not be bound to the View-Model. In this forum thread you will find more information on the subject as well as a workaround.

    Regards,
    Alexander Valchev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Alexander
    Alexander avatar
    4 posts
    Member since:
    Aug 2012

    Posted 01 Jul 2013 Link to this post

    Hi Alexander,

    Thanks for answer, I've already implemented some workaround without mvvm, but your solution is better.

    Best regards,
    Alexander
Back to Top