I am trying to allow my users to change the background color and font color for select rows.
To accomplish this, I created a button with a colorboard picker. When the user selects a color two things happen:
webix.ajax is used to update the metadata on the server, to preserve the CSS changes. That metadata is included in the $css parameter of my ui.datatable configuration.
Javascript loops through all colors on the colorboard (I used color names like pink,lightcyan,cornsilk, etc.) building the css name for each possible style (pink_stripe,blue_font, etc.) and uses $$(dtable).removeRowCss(id,style_name) to remove existing styles before using $$(dtable).addRowCss(id,style_name) to add the new style.
Problem:
The ajax side of things work fine, but the javascript removeRowCss will not remove any style that was already in the $css for ui.datatable. It will remove any style added via addRowCss, but not the existing style. I tried $$(dtable).refresh() and $$(dtable).render(). Neither helped.
Question:
How do I remove styles added via $css configuration of ui.datatable object?
While the code above addresses previously applied CSS, I cannot find a way to identify CSS classes added since the document was last refreshed. So, for example:
If the user applies a font color, then changes his/her mind, I cannot find a way to identify which color class they added and remove it.
The only means I can think of is to loop through all available user classes and “removeRowCss” for each, but this is terribly inefficient.
Is there some form of getRowCss to help identify classes just added by the user during the current edit session? Or, should I maintain my own?
$css does not get updated until you refresh the entire page. Is there a way to refresh that, so it displays the newly added class(es)?