« Return to Thread: Adding a graphic to a WebGrid

Re: Adding a graphic to a WebGrid

by Janko Mivsek :: Rate this Message:

Reply to Author | View in Thread

HiRob,

Rob Rothwell wrote:

> Can you add a graphic to a cell in a WebGrid?
>
> I am trying to draw attention to, or flag, certain elements in the list
> and would like to add a column that could contain a small graphic for
> those items.
>
> Also, could you bold or change the color of the font for only certain
> items as well?
>
> I know I could do this with a WebTable, but I would have to duplicate
> what the Grid is doing!

You can prepare and put in a cell anything you want with:

        aGrid column: aNumber addBlock: aBlock

Block is called with a current row object as argument and it must return
a valid WebElement.

For instance let we put an arrow from existing method images in first
column:

    aGrid column: 1
          addBlock: [:rowObject | WebImage gif: #arrowCircledRedGif ]

This can also be used for coloring cell content appropriately. But for
coloring entire row you have some prepared methods too:

        rowBlueIfTrue: [:rowObject | "some boolean expresion"]
        rowGreenIfTrue:, rowRedIfTrue:, rowYellowIfTrue: rowGrayIfTrue:
        rowBoldIfTrue: "for whole row to be bold"

Best regards
Janko


--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida

 « Return to Thread: Adding a graphic to a WebGrid