I'm trying to disable sorting and filtering on a column in a grid that I created from a <table></table>. Here is the table:
<
table
id
=
"vehicleList"
>
<
colgroup
>
<
col
style
=
"width: 115px;"
/>
<
col
style
=
"width: 185px;"
/>
<
col
style
=
"width: 135px;"
/>
<
col
style
=
"width: 145px;"
/>
<
col
style
=
"width: auto;"
/>
<
col
style
=
"width: 255px;"
/>
</
colgroup
>
<
thead
>
<
tr
>
<
th
data-field
=
"Number"
>Number</
th
>
<
th
data-field
=
"VehicleType"
>Type</
th
>
<
th
data-field
=
"LicensePlate"
>License</
th
>
<
th
data-field
=
"VIN"
>VIN</
th
>
<
th
data-field
=
"Pool"
>Pool</
th
>
<
th
data-field
=
"Buttons"
> </
th
>
</
tr
>
</
thead
>
<
tbody
>
@foreach (var v in Model)
{
<
tr
>
<
td
>@v.Number</
td
>
<
td
>@v.VehicleType.Name</
td
>
<
td
>@v.LicensePlate</
td
>
<
td
>@v.VIN</
td
>
<
td
>@v.Pool.Description</
td
>
<
td
>
<
input
type
=
"button"
class
=
"roundedButton blue updateVehicle"
value
=
"Update"
data-vehicleid
=
"@v.VehicleId"
style
=
"z-index: 999;"
/>
<
input
type
=
"button"
class
=
"roundedButton activateVehicle @(v.Active ? "
orange" : "green")"
value
=
"@(v.Active ? "
Deactivate" : "Activate")"
data-vehicleid
=
"@v.VehicleId"
/>
<
input
type
=
"button"
class
=
"roundedButton red deleteVehicle"
value
=
"Delete"
data-vehicleid
=
"@v.VehicleId"
/>
</
td
>
</
tr
>
}
</
tbody
>
</
table
>
And here is my code to create the Kendo Grid:
$("#vehicleList").kendoGrid({
pageable: {
pageSizes: [5, 10, 25, 50, 100],
pageSize: 5,
buttonCount: 5
},
filterable: true,
sortable: true
});
I tried this (found a thread on StackOverflow), but the columnsConfig variable is undefined so it's not working:
var grid = $("#vehicleList").data("kendoGrid");
var columnsConfig = grid.options.columns;
columnsConfig[5].filterable = false;
columnsConfig[5].sortable = false;
grid.setOptions({ columns: columnsConfig });