Add styling for existing dataview, multiview...

I would like to add additional styling for dataview, multiview and others. I can’t use css as it is a static, I would like to set some styling (for example, margin) from the javascript. How do I access the styling from javascript for existing dataview?

Hello,

Dataview as well as other data components supports “template” where you can apply styling for items. Template can be set as a function. For example:

dhx.ui({ view: "dataview", id: "myData", template: function(obj){ var color = "#000"; if(obj.type == "a") color = "#888"; return "<span style='color:"+color+"'>"+obj.title+"</span>" }, ... });

If you want to apply new styling for a certain item in this example, you can set new type and redraw an updated item (I will use “item1” id in the example):

$$("myData").item("item1").type = "a"; $$("myData").refresh("item1");