Changing css

Please visit http://www.gradekeeper.com/app/bug.html

There is one toggle button. The click handler should cause the button to change color from brown to gray to white to brown with each click. But it only changes the css the first time.

I believe the issue is that $$(id).config.css always returns the initial css. So after the first change, it always stays the same. Yet, $$(id).config.onLabel does show the changed value.

How can I get the current value of the css field for the toggle button? It would be best if config returned the current css value.

Thanks.

instead of checking config.css use webix.html.hasCss method

var view = $$(id).$view;
if(webix.html.hasCss(view, "seat1")){
...
}else if(webix.html.hasCss(view, "seat2")){
...
}else if(webix.html.hasCss(view, "seat3")){
...
}

addCss method does not change config.css value

This returns an error: webix.html.hasCss is not a function. The documentation does not show hasCss as a method of html. It is a method of proto.ui

yes, it was my mistake. but you can easily add this method to webix

webix.extend(webix.html, {
     hasCss: function(view, cssClass){
          return view.className.indexOf(cssClass)>-1;
     }
});

I tried to use this code but returns an error: “TypeError: can’t define property “hasCss”: Object is not extensible”

@davideS4bt
do you import webix.html as a module?
if yes, then you need to define own hasCss method and use it instead.