Skip to content

Instantly share code, notes, and snippets.

@sepulchered
Created December 18, 2012 14:33
Show Gist options
  • Save sepulchered/4328475 to your computer and use it in GitHub Desktop.
Save sepulchered/4328475 to your computer and use it in GitHub Desktop.
This function generates progressbar html layout.
progressBarHtmlGenerator: (function(){
var width = progressbar_width,
cls = 'x-progress', // default class as you can see in ProgressBar.js of Ext.js
tpl = new Ext.Template( // this template also was taken from ProgressBar.js
'<div class="{cls}-wrap">',
'<div class="{cls}-inner">',
'<div class="{cls}-bar" style="width: {barWidth}px">',
'<div class="{cls}-text">',
'<div>{text}</div>',
'</div>',
'</div>',
'<div class="{cls}-text {cls}-text-back">',
'<div>{textBack}</div>',
'</div>',
'</div>',
'</div>'
);
return function(value, text, textBack){
return tpl.apply({
cls: cls,
barWidth: value*width || 0,
text: text || '&#160;',
textBack: textBack || '&#160;'
})
}
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment