I am applying custom paging and sorting in the kendo grid. For one of my column I am getting a numeric text box. When I insert the value in numeric text box it is integer, but a
What Palani Kumar has said still inserts separators, that is it converts 12345 to 12,345; so i recommend the following edited code in case you want pure numbers without any formatting (no separators, no decimal points etc.).
columns.Bound(x => x.Property).Filterable(x => x.UI("numericFilter"));
<script type="text/javascript">
function numericFilter(control) {
$(control).kendoNumericTextBox({ format: "#", decimals: 0 });
}
</script>
You can set format on the filterable on the column like this:
field: "TaskId",
title: "TaskId",
width: 80,
filterable: {
ui: function (element) {
element.kendoNumericTextBox({
format: "n0"
});
}
}
Update This is the javascript version. here my complete grid defintion:
$("#uxRunningTasksGrid").kendoGrid({
dataSource: runningTasksDataSource,
height: $(document).height() - 280,
autoBind: true,
filterable: true,
sortable: true,
pageable: false,
reorderable: true,
resizable: true,
columns: [{
command: { text: "Details", click: openDetails }, title: " ", width: 80
},
{
field: "TaskId",
title: "TaskId",
width: 80,
filterable: {
ui: function (element) {
element.kendoNumericTextBox({
format: "n0"
});
}
}
}
]
};