I am using the Kendo UI (2015.3.930) Grid Control and I have a integer textbox in a grid filter row that always as decimal when I apply the filter.
Here is my code:
@(Html.Kendo().Grid((IEnumerable<UiController.Lot>)Model.Lots)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.LotNumber).Title("Lot No")
.Filterable(ftb =>ftb.ItemTemplate("NumericFilter"));
columns.Bound(c => c.BranchName).Title("Branch Name");
})
.HtmlAttributes(new { style = "height: 530px;" })
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.DataSource(dataSource => dataSource
.Server()
.Model(model => { model.Id(p => p.Id); })
)
)
My script section shows:
<script>
function NumericFilter(args) {
args.element.kendoNumericTextBox({
"spinners": false,
"format": "n0",
"decimals": 0,
});
}
</script>
For an integer value of 10, it shows '10.00' after the applying the filter. Is there a way of showing the value without the decimal portion.
I have prepared Dojo example just to show that it is possible.
I have not MVC wrappers but it looks, that it will work if you will do some small modifications to your code:
1] Change ItemTemplate in your Filterable to UI
columns.Bound(c => c.LotNumber).Title("Lot No").Filterable(ftb => ftb.UI("NumericFilter"));
2] Then you should be able to get wanted behaviour with syntax you showed in question with small (selector) modification
<script>
function NumericFilter(args) {
$(args).kendoNumericTextBox({
"spinners" : false,
"format": "n0",
"decimals": 0,
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With