AddImage - cWebColumnImage
Adds a dynamic image to the column for a particular row
Type: Procedure
Parameters
| Parameter | Type | Description |
|---|---|---|
| sUrl | String | The image URL or the image CSS Class name of the image to be added |
| sOptTooltip | String | (Optional) tooltip text |
Syntax
Procedure AddImage String sUrl String sOptTooltip
Call Example
Send AddImage sUrl sOptTooltip
Description
You must set pbDynamic to True to enable the column for dynamic images. In this case, the OnDefineImages event will be triggered in this object for every row of data that is sent to the grid.
Implement the OnDefineImages event to create the set of images to be displayed on each row. Inside OnDefineImages, you will send the AddImage message for each image you wish to add for a given row of this column.
The sURL parameter that you pass to AddImage will be returned to the OnClick event when that image is clicked. You can then use this value to identify which image was clicked in the image-set for that row. You typically obtain this URL from DownloadURL.
You can specify the name of an image to be added in two ways:
(i) Pass the image URL, (ii) Pass a CSS class name where the CSS class defines a background-image to be displayed.
Sample
See OnDefineImages for an example of how to call AddImage within the OnDefineImages event.
See pbImageByCSS for an example of using CSS classes to specify images.
Sample
Object oQRCodeColumn is a cWebColumnImage
Set piWidth to 90
Set pbFixedWidth to True
Set psCaption to "QRCode"
Set pbResizable to False
Set piListRowSpan to 3
Set peAlign to alignRight
Set pbDynamic to True
Procedure OnDefineImages
Variant[][] vData
String sReportId sCacheFolder sFileName sURL sCRLF
Move (Character(13) + Character(10)) to sCRLF
Forward Send OnDefineImages
Get OpenReport of oReport to sReportId
If (sReportId <> "") Begin
Move (Trim (Customer.Name) + sCRLF + Trim (Customer.Address) + sCRLF + Trim (Customer.City) * Rtrim (Customer.Zip)) to vData[0][0]
Send TableData of oReport sReportId 0 vData
Get ReportsCacheFolder of oReport to sCacheFolder
Move (sCacheFolder - "CustomerQR-" - String (Customer.Customer_Number) - '.jpg') to sFileName
Send ExportReport of oReport C_drImage sFileName
Get DownloadURL of ghoWebResourceManager sFileName to sURL
Send AddImage sURL
End
End_Procedure
End_Object