This is a migrated thread and some comments may be shown as answers.

Bindings doesn't works in header template of kendo grid

2 Answers 506 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 28 Jun 2013, 01:03 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 01 Jul 2013, 10:36 AM
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!
0
Alexander
Top achievements
Rank 1
answered on 01 Jul 2013, 11:30 AM
Hi Alexander,

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

Best regards,
Alexander
Tags
Templates
Asked by
Alexander
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or