Sorting by date issue..
<table id="grid">
<thead>
<tr>
<th>SNO</th>
<th data-field="NAME">NAME</th>
<th data-field="EMPID">EMPID</th>
<th data-field="CATEGORY">CATEGORY</th>
<th data-field="SUBCATEGORY">SUBCATEGORY</th>
<th data-field="CONTACTDURING">CONTACTDURING</th>
<th data-field="DEPARTMENT">DEPARTMENT</th>
<th data-field="SUBDEPARTMENT">SUBDEPARTMENT</th>
<th data-field="STATUS">STATUS</th>
<th data-field="datefrom">FROM DATE</th>
<th data-field="TODATE">TO DATE</th>
<th data-field="TOTALDAYS">TOTALDAYS</th>
<th data-field="DEATHCATEGORY">DEATHCATEGORY</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach($leaveInfo as $records){
$newDate = date("d/M/y", strtotime( $records['FROMDATE']));
$newDate1 = date("d/M/y", strtotime( $records['TODATE']));
?>
<tr>
<td></td>
<td><a href="<?php echo $this->baseUrl()?>/index/employeeprofile/id/<?php echo $records['EMPID']?>"><?php echo $records['NAME']?></a></td> <td><?php echo $records['EMPID']?></td>
<td><?php echo $records['CATEGORY']?></td>
<td><?php echo $records['SUBCATEGORY']?></td>
<td><?php echo $records['CONTACTDURING']?></td>
<td><?php echo $records['DEPARTMENT']?></td>
<td><?php echo $records['SUBDEPARTMENT']?></td>
<td><?php echo $records['STATUS']?></td>
<td><?php echo $newDate;?></td>
<td><?php echo $newDate1;?></td>
<td><?php echo $records['TOTALDAYS']?></td>
<td><?php echo $records['DEATHCATEGORY']?></td>
</tr>
<?php }?>
</tbody>
</table>
<?php }else{ echo "</br></br><div align='center'><h2>No Leave Record Found</h2></div>";
}?>
<script type="text/javascript">
var record=0;
$("#grid").kendoGrid({
schema: {
model: {
fields: {
SNO: { type: "number"},
NAME: { type: "string"},
EMPID: { type: "string"},
CATEGORY: { type: "string" },
SUBCATEGORY: { type: "string" },
CONTACTDURING: { type: "string" },
DEPARTMENT: { type: "string" },
SUBDEPARTMENT: { type: "string" },
STATUS: { type: "string" },
datefrom: { type: "date" },
TODATE: { type: "date" },
TOTALDAYS: { type: "string" },
DEATHCATEGORY: { type: "string" }
}
}
},
groupable: true,
navigatable: true,
columnMenu: true,
columns: [
{
title: " ",
template: "#= ++record #",
width: 60
},
{
field: "NAME",
title: "NAME",
},
{
field: "EMPID",
title: "EMPID",
},
{
field: "CATEGORY",
title: "CATEGORY",
},
{
field: "SUBCATEGORY",
title: "SUBCATEGORY",
},
{
field: "CONTACTDURING",
title: "CONTACTDURING",
},
{
field: "DEPARTMENT",
title: "DEPARTMENT",
},
{
field: "SUBDEPARTMENT",
title: "SUBDEPARTMENT",
},
{
field: "STATUS",
title: "STATUS",
},
{
field: "datefrom",
title: "FROMDATE",
template: '#= kendo.toString(kendo.parseDate(datefrom, "dd/MMM/yy"), "dd/MMM/yy") #'
//format: "{0:dd/MMM/yy}"
},
{
field: "TODATE",
title: "TODATE",
template: '#= kendo.toString(kendo.parseDate(TODATE, "dd/MMM/yy"), "dd/MMM/yy") #'
//format: "{0:yy}",
},
{
field: "TOTALDAYS",
title: "TOTALDAYS",
},
{
field: "DEATHCATEGORY",
title: "DEATHCATEGORY",
}
],
scrollable: true,
navigatable: true,
sortable: true,
filterable: true,
editable: "popup",
dataBinding: function() {
record = 0;
}
});
in above code from date and to date is not sorting properly..
Please help..
<table id="grid">
<thead>
<tr>
<th>SNO</th>
<th data-field="NAME">NAME</th>
<th data-field="EMPID">EMPID</th>
<th data-field="CATEGORY">CATEGORY</th>
<th data-field="SUBCATEGORY">SUBCATEGORY</th>
<th data-field="CONTACTDURING">CONTACTDURING</th>
<th data-field="DEPARTMENT">DEPARTMENT</th>
<th data-field="SUBDEPARTMENT">SUBDEPARTMENT</th>
<th data-field="STATUS">STATUS</th>
<th data-field="datefrom">FROM DATE</th>
<th data-field="TODATE">TO DATE</th>
<th data-field="TOTALDAYS">TOTALDAYS</th>
<th data-field="DEATHCATEGORY">DEATHCATEGORY</th>
</tr>
</thead>
<tbody>
<?php
$i=1;
foreach($leaveInfo as $records){
$newDate = date("d/M/y", strtotime( $records['FROMDATE']));
$newDate1 = date("d/M/y", strtotime( $records['TODATE']));
?>
<tr>
<td></td>
<td><a href="<?php echo $this->baseUrl()?>/index/employeeprofile/id/<?php echo $records['EMPID']?>"><?php echo $records['NAME']?></a></td> <td><?php echo $records['EMPID']?></td>
<td><?php echo $records['CATEGORY']?></td>
<td><?php echo $records['SUBCATEGORY']?></td>
<td><?php echo $records['CONTACTDURING']?></td>
<td><?php echo $records['DEPARTMENT']?></td>
<td><?php echo $records['SUBDEPARTMENT']?></td>
<td><?php echo $records['STATUS']?></td>
<td><?php echo $newDate;?></td>
<td><?php echo $newDate1;?></td>
<td><?php echo $records['TOTALDAYS']?></td>
<td><?php echo $records['DEATHCATEGORY']?></td>
</tr>
<?php }?>
</tbody>
</table>
<?php }else{ echo "</br></br><div align='center'><h2>No Leave Record Found</h2></div>";
}?>
<script type="text/javascript">
var record=0;
$("#grid").kendoGrid({
schema: {
model: {
fields: {
SNO: { type: "number"},
NAME: { type: "string"},
EMPID: { type: "string"},
CATEGORY: { type: "string" },
SUBCATEGORY: { type: "string" },
CONTACTDURING: { type: "string" },
DEPARTMENT: { type: "string" },
SUBDEPARTMENT: { type: "string" },
STATUS: { type: "string" },
datefrom: { type: "date" },
TODATE: { type: "date" },
TOTALDAYS: { type: "string" },
DEATHCATEGORY: { type: "string" }
}
}
},
groupable: true,
navigatable: true,
columnMenu: true,
columns: [
{
title: " ",
template: "#= ++record #",
width: 60
},
{
field: "NAME",
title: "NAME",
},
{
field: "EMPID",
title: "EMPID",
},
{
field: "CATEGORY",
title: "CATEGORY",
},
{
field: "SUBCATEGORY",
title: "SUBCATEGORY",
},
{
field: "CONTACTDURING",
title: "CONTACTDURING",
},
{
field: "DEPARTMENT",
title: "DEPARTMENT",
},
{
field: "SUBDEPARTMENT",
title: "SUBDEPARTMENT",
},
{
field: "STATUS",
title: "STATUS",
},
{
field: "datefrom",
title: "FROMDATE",
template: '#= kendo.toString(kendo.parseDate(datefrom, "dd/MMM/yy"), "dd/MMM/yy") #'
//format: "{0:dd/MMM/yy}"
},
{
field: "TODATE",
title: "TODATE",
template: '#= kendo.toString(kendo.parseDate(TODATE, "dd/MMM/yy"), "dd/MMM/yy") #'
//format: "{0:yy}",
},
{
field: "TOTALDAYS",
title: "TOTALDAYS",
},
{
field: "DEATHCATEGORY",
title: "DEATHCATEGORY",
}
],
scrollable: true,
navigatable: true,
sortable: true,
filterable: true,
editable: "popup",
dataBinding: function() {
record = 0;
}
});
in above code from date and to date is not sorting properly..
Please help..