Progress Bar in the Power Table?

Hi all,
I need to use an embedded Progress Bar (only available in Table component) but also need the Cell Spanning feature (only available in Power Table component)… It seems mutually exclusive.

So, is there any way to do Cell Spanning in a regular Table OR an embedded Progress Bar in the Power Table (OR some other clever alternative)?

Thanks for your ideas & help!

Cas

Try this in the configureCell extension function of the power table:

if colIndex==0: from javax.swing import JProgressBar bar = JProgressBar(0, 100) bar.setValue(value) return {"renderer": bar}

Obviously, yours may not be columns zero and may not be between 0 and 100, adjust as needed.

Carl,
Thanks for the quick reply… It works great!
Now my next (final?) question is how to change the colors of the foreground (the bar itself) and background (the field that the bar sits against)? For example, if I want a red bar against a white background, how do I code that?

*Note (no action needed - just a fun fact…):
I noticed that the configureCell extension function seems to be hierarchical - if I put the progress bar snippet you gave me AFTER the included script for alternating row color, the bars would not appear. But if I put the snippet BEFORE the other script, it would work fine.

Thanks again,
Cas

Just add the following

bar.background = Color.WHITE bar.foreground = Color.RED

jpark,
When I add those lines to my code, the progress bars disappear.

Prior to me adding the lines, I had:

if colName=="Order": from javax.swing import JProgressBar bar = JProgressBar(0, 100) bar.setValue(value) return {'renderer': bar}
And I saw gray progress bars.

Afterwards I had:

if colName=="Order": from javax.swing import JProgressBar bar = JProgressBar(0, 100) bar.setValue(value) bar.background = Color.WHITE bar.foreground = Color.RED return {'renderer': bar}
And the bars disappeared and were replaced with their values.

What am I doing wrong??

Thanks,
Cas

You need to add the import.

[code]if colName==“Order”:
from javax.swing import JProgressBar
from java.awt import Color

 bar = JProgressBar(0, 100)
 bar.setValue(value)
 bar.background = Color.WHITE
 bar.foreground = Color.RED
 return {'renderer': bar}[/code]

Awesome, thank you so much!
It works perfectly.

Thanks,
Cas

I am trying to build off these examples and utilize the indeterminate property to just animate the progress bar that has unknown steps to complete. I have this code in configureCell, but it only shows about 20% of the bar, stuck to the left. It’s as if the animation piece isn’t executing when it is embedded in the power table.

if colName == "Status":
		from javax.swing import JProgressBar
		from java.awt import Color
		
		bar = JProgressBar(0,100)
		bar.background = self.parent.parent.LightColor
		bar.foreground = self.parent.parent.DarkColor
		
		bar.setIndeterminate(value)
		
		return {'renderer': bar}

My status column is a boolean. Thoughts as to why it’s not animated like a progress bar component is with the indeterminate value set?

is it possible to have value displayed at the same time. At the moment I can display value or progress bar but not both.