GXT - Progress bar in grid

2009 August 18
tags: , ,
by Penguin

I want to add progress bar into the grid widget but the grid cell does not support widget inserting.

After doing research from internet, i found out one solution which is render the progress bar by inserting plain div. Here is the code i used to show the progress bar in the grid.

column.setRenderer(new GridCellRenderer()
{
    public String render(Model model, String property, ColumnData config, int rowIndex, int colIndex, ListStore store)
    {
        int progress = 70;
	String textFront = progress < 100 ? "" : progress+"%";
	String textBack = progress >= 100 ? "" : progress+"%";
	return "<div class=\"x-progress-wrap\" align=\"left\">" + "<div class=\"x-progress-inner\">" + "<div class=\"x-progress-bar" + "\" style=\"width:" + progress +  "%;\">" + "<div class=\"x-progress-text\" style=\"width:100%;\">" + textFront + "</div></div>" + "<div class=\"x-progress-text x-progress-text-back\" style=\"width:100%;\">" + textBack + "</div>" + "</div></div>";
    }
});

Hope it helps.

Share with others:
  • co.mments
  • del.icio.us
  • De.lirio.us
  • Fark
  • Shadows
  • Simpy
  • YahooMyWeb
  • Digg
  • Haohao
  • MyShare
  • Netscape
  • Technorati
  • E-mail this story to a friend!
  • Facebook
  • Furl
  • Google
  • Live
  • Webnews.de
  • description
  • description
  • Mixx
  • Scoopeo
  • Webride
  • BlogMemes Cn
  • connotea
  • kick.ie

Related Post

No comments yet

Leave A Comment

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS