If the class is not there, the call to remove will throw no errors. This minimizes if/then logic obviously. In the example below domClass is a variable mapped to 'dojo/dom-class' at the AMD signature and countLineList is a data-dojo-attach-point designation in a dojox view.
var fourColumns = "cascading-effect-for-four-columns";
var fiveColumns = "cascading-effect-for-five-columns";
var fourColumnsOrFive = fourColumns;
if (this.mdoElt.ahType != i18n.typeUnplanned) {
if (app.appSettings.AHS_ShowSystemQtyInCount) {
fourColumnsOrFive = fiveColumns;
}
}
domClass.remove(this.countLineList, fourColumns);
domClass.remove(this.countLineList, fiveColumns);
domClass.add(this.countLineList, fourColumnsOrFive);
No comments:
Post a Comment