different buttons and/or graphics per record and fancy combo

Cryptic description, let me explain… :-)

I would like to have the option to show a bunch of records, for example in Listview or Portal. Per record, I would like to add a button of an image, but based on content of the record (for example the status field) enable/disable the button, maybe show a different label of the button, or, in the case of an image, show different images, based on the content of the record (for example show different color trafficlights)

Currently, I do not know a way to do this (please correct me if I’m wrong… :D )

Also, the same sort of thing I would like to do with valuelists attached to a combo box. Let me give an example of where this comes in handy:
I’m in the proces of building a report generator. The reports can be flat data or a graph. secondly, some have specific time intervals in which the report can be run. Now, I display the available reports in a dropdown list of a combo box. What I would like to add in front of the report name is a clock image if the report can only run during a specific time interval and also add a graph image if the report is of type = Graph.

Nice feature requests, right? :)

Paul

Maarten and Johan brought it to my attention a few weeks ago that we can already add graphics or other properties like color etc. to data in any view. You can use a calculated field with html in it. You would then use something like (in htis case changing font, color and size):

Status = ‘’ + Status + ‘’.

Offcourse you can also use this to attach a picture…

Marcel, thanks for the reply.

I had to fiddle around with it a bit, but got it working in the end: for all that want to try it, here’s some code. Place this code in the Calculation Area of a calculated field (of return type= media). Then place a field or label into, for example, your listview and attach the calculated field to it. If using a field, make sure it’s of type = HTML.

if(status==1)
{
return ‘
}
else
{
return ‘
}

Take care: the names of your images are case sensitive…

As for having a picture in the drop down of the combo, I figured out the following…
If you make a valuelist with custom values and then enter the following, in the dropdown you will see the picture!!!

|1

The |1 part is what will be returned into the field onto which you attach the combobox, which displays the valuelist. Now the sad part is… once you select the needed entry from the dropdown list, the picture disappears from the field and you see the HTML code again :(

Is there some way to fix this?

Paul

:D As you can se, the images are not available on the website…

if the combobox is not editable then it should be fine..

You can’t use html and then set the combo on editable..
(because what do you edit then???)

Darn editable property… kills me everytime!! sorry for waisting time… :oops:

Hi,

Just fiddling around with the HTML combo box and run into a bug, I think.

Made a custom value list and attached it to global field of display type = combo box. This is the content of the custom value list:

Flush|1 Test|2 Test|3 Mapje|4 Test|5 Disk|6 Email|7 Wereldbol|8

Now, you clcik on the combo box, the list appears with the pictures and the text. Now, if I scroll up and down with my mouse, all text disappears on scrolling down and comes ack when I scroll up again.

If I browse through the dropdown with my cursor keys, then, when previeously having selected an item allready, when passing over the allready selected item in the dropdownlist, the text disappears, when scrolling up again the text shows again, only now it white, but in black.

Looks like some kind of bug to me..

Working on windows XP, latest RC, java 1.4.2 and standard LAF

Paul

PS: Any tip on how to line out the text under eachother would b appreciated… :D

yes already seen this. i fixed it in RC5.

tnx Johan.

Any tip on how to make sure that the text lines out under eachother if you have pictures in front of them?

I tried it with < table> in HTML, but didn’t get the correct result yet (don’t think you can set the width per column with this command, right?)

Other option would be to make sure all the images have the same size, I guess.

Any other (more correct) way of doing this?

Paul

can’t you try it with a table/align (didn’t test it)

image text

Hi, fiddled with it and here’s the solution:

Flush
|1
Test
|2
Test
|3

Just dop this code in a custom valuelist and attach it to a combo box type of field.

This gets you a drop down list with images, where the image is the first column and the text is the second column. The images are centered in their column and the Text is nicely left aligned, under eachother.

So, when the disappear bug is fixed in RC5, you can have yourself a nice fancy combobox :-)

Paul

Hi

I have a field called general_tag.

If this tag ==1 then I want to show an image in the list .

If not then I want show a different image.

I created a calculation using the tip given in this post

if( general_tag == "1") 
{ 
return '<html><img src="media:///TagBlue.GIF"></html>'
}
else
{
return '<html><img src="media:///TagGrey.GIF"></html>;'
}

I placed the calculation media field on my list. Also checked the displays tags property but it only shows html text not the image

Am I missing something?

Thanks
Ahmad

This worked after I used a text label to display the calculated field instead of media field

Thanks
Ahmad