Pictures in dynamic lists

The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 19, 2016
Company:

Question: How to show in dynamic lists image from database from ValueStorage field (not by RowPictureDataPath way)?
Use case: showing pictures of items catalog in ChoiceForm. For each Item used different picture, so there could be thousands of pictures in the list.

 
#2
People who like this:1Yes/0No
Administrator
Rating: 7
Joined: Nov 3, 2011
Company: 1C Company

There are two ways to display a picture of an item:

1. Display a picture directly in the list.

This method is not recommended because it might significantly impact application performance (due to a lot of client-server requests).

2. Display a picture in a separate field.

Add a field of Picture type to your form. Link the field to a String attribute (for example, the attribute name is ItemPicture).

Add OnActivateRow handler to the dynamic list table. In this handler, use GetURL method to get the URL of the picture stored in your configuration and write it to ItemPicture attribute.

Then, every time you move the cursor through your dynamic list, the picture will change.

 
#3
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 19, 2016
Company:

Thank you Yulia! But if use the first way - to display a picture directly in the list, how to do this in the managed application? ValueStorage type is not supported on client side forms, it seems like it is impossible to show the value in the list.

 
#4
People who like this:3Yes/0No
Just came
Rating: 1
Joined: Nov 10, 2015
Company: Clever Business Solutions

Make in Query DynamicList a column Type string (150)

Ex:<<--

Select
***,
***,
CAST("NavLinkImg" AS String(150)) AS URLImg

-->

Column type on the form AS "Image field"

After on a Procedure OnGetDataAtServer Ins ert the Get URL code:

Ex:<<--

&AtServerNoContext
Procedure ListOnGetDataAtServer(ItemName, Settings, Rows)
For Each ItemRow In Rows Do
ItemRow.Val ue.Data.URLImg = GetURL(ItemRow.Key, "FileStorage");
EndDo;
EndProcedure

-->>

Edited: Alex Mr - Aug 03, 2017 03:21 AM
 
#5
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 19, 2016
Company:

Thank you Mr. Alex! But in managed application the event ListOnGetDataAtServer is not available. At least in the 8.3.8.2322 version.

 
#6
People who like this:1Yes/0No
Administrator
Rating: 7
Joined: Nov 3, 2011
Company: 1C Company

Alexey, it's available in managed applications since version 8.3.10.

 
#7
People who like this:1Yes/0No
Just came
Rating: 1
Joined: Nov 10, 2015
Company: Clever Business Solutions

You can try to record URL in Attribute.
Use the procedure BeforeWriteAtServer:

Ex: <--

&AtServer
Procedure BeforeWriteAtServer(Cancel, CurrentObject, WriteParameters)

CurrentObject.NewAtributeURLImg =  GetURL(CurrentObject, "FileStorage");

EndProcedure

-->

Edited: Alex Mr - Aug 03, 2017 03:18 AM
 
#8
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 19, 2016
Company:

Mr. Alex, Ms. Yulia thank you!

 
#9
People who like this:1Yes/0No
Active user
Rating: 3
Joined: Jan 11, 2021
Company: Robot cho mọi người


I hope this video can help

 
#10
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Oct 4, 2018
Company:

Phan Hoàng Anh, Very good way! You're cool man, bro!

 
Subscribe
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.