Completed
Last Updated: 23 Jan 2020 12:11 by ADMIN
Heiko Falk
Created on: 09 Sep 2013 09:24
Category: Grid
Type: Feature Request
3
Apply cell format to filter
Currently having a column format of "{0:#}" does not infect the filters format. E.g. 5 becomes to 5.00 on blur event in filter dialog. So we have to modify filters behaviour manually which is a pain. Currently we are using this function:


function configureFilterFormatting($grid) {
    var kendoGrid = $grid.getKendoGrid();
 
    kendoGrid.bind('filterMenuInit', function (event) {
        var column;
 
        $j.each(event.sender.columns, function (index, item) {
            if (item.field == event.field) {
                column = item;
                return;
            }
        })
 
        if (!column) {
            throw new Error('Invalid column');
        }
 
        if (column.format) {
            // Transform '{0:#}' in '#'
            var format = column.format.replace(/^{0:/, '').replace(/}$/, '');
 
            event.container.find('[data-role=numerictextbox]').each(function () {
                var $numericTextbox = $j(this);
                $numericTextbox.getKendoNumericTextBox().setOptions({ format: format })
            });
        }
    });
}
1 comment
ADMIN
Alex Hajigeorgieva
Posted on: 23 Jan 2020 12:11

Hi,

The functionality can be achieved by providing a custom editor and setting its format option:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.filterable.ui

Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.