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

Unknown params when using column filterable

4 Answers 90 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jacob
Top achievements
Rank 1
Jacob asked on 23 Jan 2015, 09:08 AM
Hi,

Working with MVC5 and Kendo().Grid.
Using filter on columns, won't fire the javascript function with the right params or I don't understand how to !!
The aim is to remove the decimals from the integer in the filter box.

This is what I have:
.Columns(columns =>
    {
        columns.Bound(e => e.InternalId).Width(60).Filterable(filter => filter.UI("NumericFilter()"));
    })

-and the function:
function NumericFilter(control) {
    alert ("Got here...");
    $(control).kendoNumericTextBox({ "format": "n0", "decimals": 0 });
}

When the function is called, the param is null. If removing the parentheses from the function name in the filter definitions, the call is not fired at all.
The above code is found somewhere else on this site.
Thanks.

4 Answers, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 26 Jan 2015, 11:22 AM
Hi Jacob,

The UI method should specify the only name of the function, thus you should remove the parentheses. However, note that the filter.UI will be executed only when the filter mode is Menu. Therefore, you should check in which mode the grid in question is set. If the mode is Row, you will need to use Template option instead:

.Filterable(ftb => ftb.Cell(cell => cell.Template("NumericFilter")))


Regards,
Rosen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jacob
Top achievements
Rank 1
answered on 26 Jan 2015, 11:54 AM
Hi Rosen,

That did change something, but the decimals are still not removed.
This line:
$(control).kendoNumericTextBox({ "format": "n0", "decimals": 0 });
-seems to be wrong.
Could you please put me in the right direction.
Thanks :-)
0
Jacob
Top achievements
Rank 1
answered on 26 Jan 2015, 12:10 PM
An another side effect of using ".Filterable(ftb => ftb.Cell(cell => cell.Template("NumericFilter")))" is that the textbox layout is lost, why ??
0
Accepted
Rosen
Telerik team
answered on 27 Jan 2015, 07:10 AM
Hi Jacob,

The signature of the function used with Filterable Row mode is different than the one used when in Menu mode. Therefore, you will need to change the code similar to the following:

function NumericFilter(e) {
    alert ("Got here...");
    $(e.element).kendoNumericTextBox({ "format": "n0", "decimals": 0 });
}


Regards,
Rosen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

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