Dynamic cells in Treeview Bean

Questions and answers on developing, deploying and using plugins and JavaBeans

Dynamic cells in Treeview Bean

Postby joshua » Thu Feb 06, 2014 5:58 pm

I'm trying to develop a UI that allows our users to use a tree based table of statuses for various tasks. Currently I'm using the Treeview bean found here: https://www.servoyforge.net/projects/servoy-treeview

Here's a quick mock up
Image

We use flags in the database to track the progress of a task using integers. So 0 would be 'incomplete' and 1 would be 'complete', etc.

What I need is a way to dynamically show that data as an image in the treeview bean. In other tables within servoy we've used data calculations to replace the integer with an image url to great affect. We use small exclamation icons to note something that is a "no order" by replacing a 1 with the image url, etc.

I've tried looping through the dataset and replacing the integers with the url for the image and the bean just displays the string instead of the image. It seems all the fields are just text fields.

Code: Select all
for ( var i = 1 ; i <= ds.getMaxRowIndex() ; i++ ){
      if(ds.getValue(i,4) == '0'){
         ds.setValue(i,4,"media:///alert.png")
      }
   }


results in:
Image

Does the treeview bean support this in any way? If not, is there some other method of creating a treeview like table that allows a level of customization like the normal table view in servoy?

Thanks!
joshua
 
Posts: 10
Joined: Sat Apr 21, 2012 10:56 pm

Re: Dynamic cells in Treeview Bean

Postby joshua » Thu Sep 18, 2014 5:47 pm

Just wanted to give an update for anyone that may run into this need in the future.

I was able to cobble together a workaround of sorts to accomplish what I wanted here.

Image

As you can see in this image I have the treeview on the left and the desired dynamic cells on the right. I was not able to find a way to accomplish this using just the treeview bean so instead I used two separate objects here. The left is the treeview bean with no columns. On the right is a table built using the table bean found here.

What I did was add methods to the expand and collapse actions on the treeview to rerender the table on the right and made sure the sql for the datasets were written in a way that the rows would always match. So far it's working quite well with just a very small delay in rendering the table after expanding or collapsing the node.

If you have any questions I'd be happy to answer them.
joshua
 
Posts: 10
Joined: Sat Apr 21, 2012 10:56 pm

Re: Dynamic cells in Treeview Bean

Postby lwjwillemsen » Thu Sep 18, 2014 7:20 pm

UI wise very nice !
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: Dynamic cells in Treeview Bean

Postby david » Thu Sep 18, 2014 11:19 pm

joshua wrote:Does the treeview bean support this in any way? If not, is there some other method of creating a treeview like table that allows a level of customization like the normal table view in servoy?


I'm pretty sure html displays in the treeview bean. So you could create calculations that return a block of html with an img tag showing whatever media image based on your flags.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 4 guests