java - How to add specific color to Table row in Vaadin? -
i'm trying change color of row on table based on hex value row item. i'm trying generate css on fly similar generating csslayout this
csslayout content = new csslayout( ) { @override public string getcss( component c ) { return "background: " + colorcode + ";"; } };
here's code i'm using
table.setcellstylegenerator( new table.cellstylegenerator( ) { public string getstyle( object itemid, object propertyid ) { return "green"; } } );
but works setting stylename, i'd have have millions of style names accommodate possible hex values colors user wants.
you can use cssinject add-on add needed style name on fly.
see https://vaadin.com/directory#addon/cssinject
string color = "#ccddff"; cssinject css = new cssinject(getui()); css.setstyles("."+color+" { background-color: "+color+"; }");
Comments
Post a Comment