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

row template and sortable together doesn't work

2 Answers 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 14 Feb 2012, 09:51 PM
i need to use row template and sortable features together. But it is not working. Can somebody help me how do i fix this?
My sample code is below: 
###############################################


<script src="path/to/jquery"></script> 
        <script src="path/to/kendo/all/js"></script> 
<script src="../../content/shared/js/people.js"></script>
        <link href="../../../styles/kendo.common.min.css" rel="stylesheet" />
<div id="example" class="k-content">
            <table id="people">
                <thead>
                    <th>Id</th>
                    <th>First Name</th>
                    <th>Last Name</th>
                    <th>Title</th>
                    <th>Age</th>
                </thead>
                <tbody>
                    <tr>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                    </tr>
                </tbody>
            </table>
            <script id="template" type="text/x-kendo-template">
                <tr class="asdf">
                     <td>#= Id #</td>
                    <td>#= FirstName #</td>
                    <td>#= LastName #</td>
                    <td>#= Title #</td>
                    <td>#= Age #</td>
                </tr>
            </script>
            <script>
                $(document).ready(function() {
                    //initialize dropdownlist components
$("#people").kendoGrid({
dataSource: {data: createRandomData(500)},
height: 200,
sortable: true,
rowTemplate: kendo.template($("#template").html())
});
   
                });
            </script>




#############################################


Thank you!

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 15 Feb 2012, 09:24 AM
Hi Benjamin,

As you have created the grid from a table with header element defined, you should also set the field name to each of the th element:

<table id="people">
  <thead>
      <th data-field="Id">Id</th>
      <th data-field="FirstName">First Name</th>
      <th data-field="LastName">Last Name</th>
      <th data-field="Title">Title</th>
      <th data-field="Age">Age</th>
  </thead>
<tbody>
</tbody>
</table>

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jesus
Top achievements
Rank 1
answered on 06 Apr 2012, 01:00 AM
hi.... show code please

<script src="../../content/shared/js/people.js"></script> 



Tags
Grid
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Jesus
Top achievements
Rank 1
Share this question
or