![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
![]() |
Sun, Oct 9 2016 2:52 PM | Permanent Link |
thomh | Hi,
What is the recipe for loading images into a grid column that is bound to a dataset. The grid column ControlType is set to ctImage and is bound to a dataset column called "Status". Should this "Status" column be of type string and contain a URL to where the images are located? // Thom |
Tue, Oct 11 2016 11:06 AM | Permanent Link |
thomh | Switched to column ControlType = ctIcon instead.
// Thom |
Tue, Oct 11 2016 11:44 AM | Permanent Link |
thomh | But I am still interested in what happens when ctImage is used.
I see that this is sent to server "GET /databases/images/MyImage.png". But what is the correct response that the server needs to send back? // Thom |
Tue, Oct 11 2016 12:44 PM | Permanent Link |
Raul ![]() | On 10/9/2016 2:52 PM, thomh wrote:
> What is the recipe for loading images into a grid column that is bound to a dataset. > > The grid column ControlType is set to ctImage and is bound to a dataset column called "Status". > Should this "Status" column be of type string and contain a URL to where the images are located? Yes - that's all you need to do (can be relative URL which it is for below). For example if you look at the "databound" example then it includes a customer table with photo in the ContactPhoto field. Dropping a grid, linking it to Customers dataset and then configuring a column for ContactPhoto with column type ctImage shows the photo in the grid cell. I do recommend increasing the rowheight in this case to see actual image properly. Looking at the communications underneath the original dataset JSON returns all rows and ContactPhoto for first record is : ?method=load&database=ExampleData&dataset=Customer&column=ContactPhoto&row=ADF and then new request goes out for http://<ip and port>/databases?method=load&database=ExampleData&dataset=Customer&column=ContactPhoto&row=ADF and response to that is the actual png image (raw data). Grid actually will fetch new images only as you scroll them into visible area so as you scroll additional images are loaded. Raul |
Tue, Oct 11 2016 4:33 PM | Permanent Link |
thomh | Thanks, Raul.
What is the proper reponse to send back to client? I am returning a PNG file and send back this response (from a RealThinClient coded sever): Server.Response['Cache-Control'] := 'no-cache'; Server.Response['Content-Type'] := 'image/png'; Server.Response.Status(200, 'OK'); However, the image does not show up in the databound image control. // Thom |
Tue, Oct 11 2016 5:22 PM | Permanent Link |
Raul ![]() | On 10/11/2016 4:33 PM, thomh wrote:
> What is the proper reponse to send back to client? > > I am returning a PNG file and send back this response > (from a RealThinClient coded sever): > > Server.Response['Cache-Control'] := 'no-cache'; > Server.Response['Content-Type'] := 'image/png'; > Server.Response.Status(200, 'OK'); > > However, the image does not show up in the databound image control. That looks OK to me - i suggest you use the browser debug tools to see what's going on exactly underneath. (it's usually F12 and then look for network tab). For comparison this is what the result headers looks like for databound example image using EWB IDE and chrome: HTTP/1.1 200 Date: Tue, 11 Oct 2016 21:18:13 GMT From: Server: Internal Web Server Connection: Keep-Alive Cache-Control: no-cache Content-Type: image/png Content-Length: 53399 Raul |
Tue, Oct 11 2016 5:23 PM | Permanent Link |
Walter Matte Tactical Business Corporation | Thom:
Here is what I do... EWBGetGraphic(Request); // see below Response.ContentType := Request.Info.asString['contenttype']; Response.HeaderText := Response.HeaderText + RtcString(GetGenericHeader); // see below WriteEx(Request.Info.asByteArray['img']); function TdmRTCProviders.GetGenericHeader: string; begin result := 'Access-Control-Allow-Origin: *' + #13#10 + 'Cache-Control: must-revalidate, post-check=0, pre-check=0' + #13#10 + 'Cache-Control: no-cache, no-store' + #13#10; end; // IMPORTANT BITS OF EWBGETGRAPHIC // tbX is database table. The graphic is in a Blob and the Content Type is in a Field // so I store the Content Type 'image/png' in Request.Info['contenttype'] // then the Graphic is read from a Blob Field and put into a TRTCByteArray // Request.Info.asByteArray['img'] // Then the Header is filled in, content type and use WriteEX to send the graphic to the browser. Passed into the procedure: Request: TRtcServerRequest var buffer : RtcByteArray; Request.Info['contenttype'] := tbX.FieldByName(sField + '_ContentType').Asstring; buffer := Request.Info.NewByteArray('img',TBlobField(tbX.FieldByName(sField)).BlobSize); Move(TBlobField(tbX.FieldByName(sField)).Value[0], buffer[0], TBlobField(tbX.FieldByName(sField)).BlobSize); Walter |
This web page was last updated on Wednesday, November 29, 2023 at 09:43 PM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |