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

Sorting not working when using RowTemplates

4 Answers 298 Views
Grid
This is a migrated thread and some comments may be shown as answers.
HArjit
Top achievements
Rank 1
HArjit asked on 27 Jun 2013, 02:50 PM
Hi there,

 I  have grids which are use row templates to display data, when I start using the row templates, my sorting stops working. Is there anything which I'm missing. My template code is as follows

<script id="gridItemsRowTemplate" type="text/x-kendo-template">

    # var columns = $("\\#" + gridID).data("kendoGrid").columns #

    <tr data-uid="#= uid #" role ='row'>
        #for(properties in columns) {#

        #if (columns[properties].field == 'Id' || columns[properties].field == 'Hidetype') {#
            <td role="gridcell" style ="display:none;"> #data[columns[properties].field] #</td>
         #}else {#
            #if (data[columns[properties].field] != undefined) {#
            <td > #= data[columns[properties].field].val #</td>
              #}#

           #}#
        #}#
    </tr>
</script>

4 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 28 Jun 2013, 08:55 AM
Hello Harjti,

 
In order to enable the Grid sorting in the Kendo UI "Row template"  you need to set a data-field attribute to the rows in the header of the table. For example:

<th data-field="Name">Name</th>
<th data-field="Age">Age</th>
<th data-field="DateOfBirth">Date Of Birth</th>

There is a forum thread where you can find a very similar discussion.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
HArjit
Top achievements
Rank 1
answered on 28 Jun 2013, 01:06 PM
My column types and fields are being generated at run time so is my grid. how can i inject them in the header in the row template ? 

Harjit
0
Accepted
Kiril Nikolov
Telerik team
answered on 28 Jun 2013, 05:58 PM
Hello Harjit,

 
As I said In order to enable the Grid sorting in the Kendo UI "Row template" you need to set a data-field attribute to the rows in the header of the table. In your case set the data-field when you generate your template.

Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
HArjit
Top achievements
Rank 1
answered on 28 Jun 2013, 06:06 PM
Got  it !!!

- Harjit
Tags
Grid
Asked by
HArjit
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
HArjit
Top achievements
Rank 1
Share this question
or