Table Bean row images

I am using the great table bean from http://www.servoy-plugins.de

I have a question though. Does anyone know of a way to get display an image, or icon, in a row dynamically in the dataset grid?

What I want is for an icon to appear on a row when a certain data value is true. I can do this pretty easily with a normal table object in servoy using calculations but cannot with the dataset grid table bean.

Any suggestions?

Thanks!

HI,
You will need to loop through the dataset and set the icon before displaying. So… something like below

//First get your dataset
var ds = databaseManager.getDataSetByQuery("your_server","SELECT column1, column2, newColumn AS icon FROM table", null,-1)
	
//Now loop through dataset and set the media in your new column
for ( var i = 1 ; i <= ds.getMaxRowIndex() ; i++ ){
	if(ds.getValue(i,1) == "Apples"){
		ds.setValue(i,3,"media:///apple_icon.png")
	}
}
	
//Display ds in table
forms.formname.elements.datasetGrid.setData( ds,  ["column1", "column2", "icon"])

That worked perfectly!

Thank you!

Great…