cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kspoojary
Level: Powered On

Loading Image for Gallery Control

Hi ,

 

I have Gallery Control and i am showing a loader image when gallery is loading. I am using Image's Visible property to show and hide the loader image based on the Gallery controlss Item.

 

like this

Image1.Visible =IsEmpty(Gallery1.AllItems).

 

This works perfect if we are getting some records from the datasource. Problem is if there is no record then the loading image will be visible forever. I want to show no record lable in case if there is no data.

 

Any help is apperciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft dinusc
Microsoft

Re: Loading Image for Gallery Control

Sample code:

Screen1.OnVisible=UpdateContext({v:true})

Image1.Visible=v

Timer1.AutoStart=true

Timer1.OnTimerEnd=UpdateContext({v:false})

 

Timer1.Duration=4000

 

View solution in original post

11 REPLIES 11
Microsoft dinusc
Microsoft

Re: Loading Image for Gallery Control

I'm not sure the "IsBlank" function is a good choice here. Try using CountRows(Gallery1.AllItems)=0

kspoojary
Level: Powered On

Re: Loading Image for Gallery Control

Hi , my code is working properly when there is data. But in some scenario's if there is no data, I want to hide the loading Image and show the no records found lable.

Currently I don't have control on when to hide the image because there no event that notify.

 

 

Also I found the LoadingSpinner property on the Screen control what is the purpose of it? and how to use it?

Microsoft dinusc
Microsoft

Re: Loading Image for Gallery Control

I understand now. Unfortunately there's no easy way to resolve this currently. The problem is that when you assign your gallery to a source, you will get the records quickly (AllItems will not be blank) but those records will contain just the image links which will take time to load.

If what you have now works to your satisfaction and the only issue is to handle the situation when the bound source actually does not contain any data then I don't think there's a better solution then just setting a timer to cancel your progress indicator.

The LoadingSpinner property just controls the "running dots" animation at the top of your screen.

kspoojary
Level: Powered On

Re: Loading Image for Gallery Control

@dinusc Thanks. I will try the timer approach

Super User
Super User

Re: Loading Image for Gallery Control

Hello..

Can you please share what is the source of the gallery?
What if you have Image1.Visible =IsEmpty(Gallery1.AllItems)&&LookUp(DatasourceOfTheGallery,true,true)

kspoojary
Level: Powered On

Re: Loading Image for Gallery Control

Gallery1.Items=SortByColumns(Search(Filter('[dbo].[v_DRMS_OPPORTUNITIES_CUSTOMERLIST]_1',AMID=amid), TextSearchBox1.Text, "CUST","CUST_PK"), "CUST", If(SortCustDescending, Descending, Ascending))

Super User
Super User

Re: Loading Image for Gallery Control

Does 

Image1.Visible =IsEmpty(Gallery1.AllItems)&&LookUp(Search(Filter('[dbo].[v_DRMS_OPPORTUNITIES_CUSTOMERLIST]_1',AMID=amid), TextSearchBox1.Text, "CUST","CUST_PK"),true,true)

work? Did you try?

kspoojary
Level: Powered On

Re: Loading Image for Gallery Control

I tried this but it is not working, still I can see the loading image. 

kspoojary
Level: Powered On

Re: Loading Image for Gallery Control

@dinusc can you please help me with sample code for Timer.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,714)