James Wierzba James Wierzba - 3 months ago 16
HTML Question

Kendo Grid: How to disable "filterable" on data-column definition?

I have defined a kendo grid declaratively with a

data-columns
attribute. Some columns have a
"filterable": ...
attribute defined, and some don't. The ones that do not have it defined still show the filter textbox with all of the options "Equal to", "Starts with", ... etc.

I would like to have no filter textbox at all on these columns for which I've not defined the attribute.

How can I explicitly remove the filter textbox?

My grid definition:

<div id="Checkpoints">
<div data-filterable='{ "mode": "row" }'
data-role='grid'
data-sortable='true'
data-bind='source: reportData.CheckpointExceptions'
data-pageable='{ "pageSize": 10 }'


data-toolbar='["excel"]'
data-excel='{ "fileName": "CheckpointExceptionExport.xlsx", "allPages": "true" }'
data-excelExport='e -> excelExportHelper(e)'

data-columns='[
{
"field": "checkpoint_name",
"title": "Checkpoint",
"filterable": { "cell": { "operator": "contains"}}},
{
"field": "location_name",
"title": "Location",
"filterable": { "cell": { "operator": "contains"}}
},
{
"field": "patrolled_by",
"title": "Patrolled By",
"filterable": { "cell": { "operator": "contains"}}
},
{
"field": "geotag",
"title": "GeoTag",
"template": kendo.template($("#geotagTemplate").html())
},
{
"field": "geofence",
"title": "GeoFence",
"template": kendo.template($("#geofenceTemplate").html())
},
{
"field": "completed",
"title": "Completed",
"template": kendo.template($("#completedTemplate").html())
},
{
"field": "gps",
"title": "GPS",
"template": kendo.template($("#gpsTemplate").html())
},
{
"title": "",
"template": kendo.template($("#viewLinkTemplate").html())
}
]'>
</div>



Answer

Declare the filterable property for the fields you do not want to be filterable, then explicitly set it to false, as it's done in this jsFiddle.