i'm trying to bind a CSS class to a button of a kendo menu : Here is my code for the menu :
{
id: "button_grille_tri",
type: "splitButton",
menuButtons : $scope.liste_recherche,
click: function(e){
$scope.rechercheColonnes(e);
}
},
it's a part of the menu which works.
Here is the instanciation of the liste_recherche variable :
for(var i=0;i<$scope.siagridColumns.length;i++){
$scope.liste_recherche.push({
cssClass : "champ_recherche",
attributes: {"ng-class": "{'tick_recherche':tickActivation("+"'"+$scope.siagridColumns[i].id+ "'"+ ")}"} ,
text : $scope.siagridColumns[i].header, id : $scope.siagridColumns[i].id });
}
tickActivation is a function that return a boolean :
$scope.tickActivation = function(id){
return $scope.etats[id];
};
i have tried several things : 1) if i replace ng-class by class, the class is working but not dynamically 2) i put the ng-class into the text part with the good format, and it didnt worked no matter the quotes issues, i tried all the possibilities 3) even if i replace tickActivation(...) by true it doesnt work. 4) i have put a $scope.$apply into another :
$scope.rechercheColonnes = function(e){
if ($scope.colonnesTri.length == $scope.siagridColumns.length){
$scope.colonnesTri =[];
}
var compteur = 0;
for (var i=0;i<$scope.colonnesTri.length;i++){
if ($scope.colonnesTri[i] == e.id)
compteur++;
}
if(compteur == 0){
$scope.colonnesTri.push(e.id);
}
$scope.etats[e.id] = true;
$scope.$apply();
}
and with that $apply, i can see that tickActivation is used on each click on the menu, with the good argument and a fine return. But there is no binding and the ng-class doesnt work... i havent find any answers on any documentation / community. At least, thank you for reading the post, i hope someone will find the solution.