Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Progress Bar sample

English
Assuming the column cell is returning numbers ranging from 0 to 100, we can apply Bean Shell Formatter with the following code.
Code Block
languagejava
linenumberstrue
if(value == ""){
    value = "0";
}

String numberOnly= value.replaceAll("[^0-9]", "");

int percent = Double.parseDouble(numberOnly);

if(percent == 100){
	return "<div class=\"progress\"><div class=\"progress-bar progress-bar-success progress-bar-striped\" role=\"progressbar\"aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:100%\">100% Complete</div></div>";
}else{
	return "<div class=\"progress\">  <div class=\"progress-bar progress-bar-striped active\" role=\"progressbar\"  aria-valuenow=\"" + value + "\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:" + value + "%\">    " + value + "%  </div></div>";
}