Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 6 of 6 total |
Bound Grid and images |
Mon, Jan 16 2017 8:25 AM | Permanent Link |
Uli Becker | I want to display small images in a databound grid. Have I to use a blob field or is it possible to store a URL in a string field? If so: does the grid recognize that and load the image?
Till now I couldn't get it to work both ways. Thanks Uli |
Mon, Jan 16 2017 8:43 AM | Permanent Link |
Raul Team Elevate | On 1/16/2017 8:25 AM, Uli Becker wrote:
> I want to display small images in a databound grid. Have I to use a blob field or is it possible to store a URL in a string field? If so: does the grid recognize that and load the image? > Till now I couldn't get it to work both ways. It should definitely work by storing a blob - that's how databound example works for example. EWB web server turns it into a URL still so you actually end up with 2 requests : 1. load data which returns json that includes image url 1.1 EWB then assigns this url to the underlying image element of grid 2. image component triggers a browser requests to load image actual image that returns the raw image data In theory you can store just a URL but you'd have to check how grid loads it exactly and whether you have to do something extra. It would be available and can be easily loaded into timage (not grid related exactly but found this older discussion : http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=11134) Raul |
Mon, Jan 16 2017 12:36 PM | Permanent Link |
Uli Becker | Raul,
> It should definitely work by storing a blob - that's how databound > example works for example. That's what I expected. After some debugging I found out that my test table didn't have a primary key, so the blob column request didn't work. After having added the index, it works fine. > In theory you can store just a URL but you'd have to check how grid > loads it exactly and whether you have to do something extra. It would be > available and can be easily loaded into timage (not grid related exactly > but found this older discussion : > http://www.elevatesoft.com/forums?action=view&category=ewb&id=ewb_general&page=1&msg=11134) Ok, I'll check out the sources how TGrid load the images. Thanks a lot Uli |
Tue, Jan 17 2017 3:24 AM | Permanent Link |
Uli Becker | Raul,
> In theory you can store just a URL but you'd have to check how grid > loads it exactly and whether you have to do something extra. That turned out to be very simple: Assumed that the Column contains just the image's filename: procedure TForm1.GridColumn7CellUpdate(Sender: TObject; ACell: TGridCell); begin ACell.Font.Color := clTransparent; ACell.Background.Image.Name := 'images/' + ACell.Data + '.jpg'; end; Uli |
Wed, Jan 18 2017 2:43 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Uli,
<< I want to display small images in a databound grid. Have I to use a blob field or is it possible to store a URL in a string field? If so: does the grid recognize that and load the image? Till now I couldn't get it to work both ways. >> Are the images simply "free-standing" in the content directory for the web server ? If so, then yes, you *should* be able to do so by using a plain string field for the URLs combined with a grid column whose ControlType is set to ctImage. I say *should* here because I just checked and currently this only works if the grid column isn't bound to a dataset column. The reason why is because the grid column wants to use the BaseURL property from the dataset as the prefix to the URL. This is necessary for BLOBs, especially with cross-origin requests, so I'll have to make some adjustments to the code in order to allow it to behave differently for non-BLOB, string fields. Tim Young Elevate Software www.elevatesoft.com |
Wed, Jan 18 2017 5:28 PM | Permanent Link |
Uli Becker | Tim,
> Are the images simply "free-standing" in the content directory for the web server ? Yes. If so, then yes, you *should* be able to do so by using a plain string field for the URLs combined with a grid column whose ControlType is set to ctImage. I say *should* here because I just checked and currently this only works if the grid column isn't bound to a dataset column. The reason why is because the grid column wants to use the BaseURL property from the dataset as the prefix to the URL. This is necessary for BLOBs, especially with cross-origin requests, so I'll have to make some adjustments to the code in order to allow it to behave differently for non-BLOB, string fields. That's what I found out by using Chrome debugger - thanks for fixing this. Uli |
This web page was last updated on Friday, November 1, 2024 at 07:01 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |