Hello,
I found a video and files showing how to disable filtering for a column.
The following code is not correct:
onShow: function($scope, customData) { $scope.customerList.options.columnMenu = true; $scope.customerList.options.filterable = { mode: "row"}; disableFilter = ["CustNum","Address"]; for (var i = 0; i < $scope.customerList.options.columns.length; i++) { if (disableFilter.indexOf($scope.customerList.options.columns[i].field) > -1) { $scope.customerList.options.columns[i].filterable = false; } } },
Both $scope._$ds.options and $scope.grid.options are invalid.
What is the correct syntax to access the options and columns properties?
Best regards,
Bert
Hello Bert,
Sorry for the issues.
The video that you mentioned was made using Kendo UI Builder 1.0.
Version 1.1 changed some of the references.
The code should use "model" instead of "customerList".
It would look like the following:
$scope.model.options.columnMenu = true;
$scope.model.options.filterable = { mode: "row"};
disableFilter = ["CustNum","Address"];
for (var i = 0; i < $scope.model.options.columns.length; i++) {
if (disableFilter.indexOf($scope.model.options.columns[i].field) > -1) {
$scope.model.options.columns[i].filterable = false;
}
}
Please also consider that references such as $scope._$ds may look a bit different between a pre-defined view template vs user-defined view (Blank view option). You can use the Web Inspector tool to confirm on the values of the references.
A general tip on this would be to put this code into a function / API so you could use it from multiple views. In this way, if you needed to change the implementation then you would only change it in one place.
I hope this helps,
Edsel
Hello Bert,
Sorry for the issues.
The video that you mentioned was made using Kendo UI Builder 1.0.
Version 1.1 changed some of the references.
The code should use "model" instead of "customerList".
It would look like the following:
$scope.model.options.columnMenu = true;
$scope.model.options.filterable = { mode: "row"};
disableFilter = ["CustNum","Address"];
for (var i = 0; i < $scope.model.options.columns.length; i++) {
if (disableFilter.indexOf($scope.model.options.columns[i].field) > -1) {
$scope.model.options.columns[i].filterable = false;
}
}
Please also consider that references such as $scope._$ds may look a bit different between a pre-defined view template vs user-defined view (Blank view option). You can use the Web Inspector tool to confirm on the values of the references.
A general tip on this would be to put this code into a function / API so you could use it from multiple views. In this way, if you needed to change the implementation then you would only change it in one place.
I hope this helps,
Edsel