Vincent7036552
Posts: 0
Joined: Mon Aug 11, 2014 10:32 am

Hide components when empty list

Hi guys,

I would like to hide a label and a list when the list is empty.

You can see on the screenshot, I would like to hide the "Your recent activity" label and list below.

Any ideas on how to do it?

Thanks

Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Hide components when empty list

Hi Vincent,

You can use the following functions to hide/show a component:
preApperyio("componentName").hide();
Apperyio("componentName").show();/preWhere 'componentName' is a component name.

Vincent7036552
Posts: 0
Joined: Mon Aug 11, 2014 10:32 am

Hide components when empty list

Thank you Katya.

And how do I count the number of elements in the list?

Thanks,

Vincent7036552
Posts: 0
Joined: Mon Aug 11, 2014 10:32 am

Hide components when empty list

PS: Even better than the number of elements in the list would be to get the number of elements returned by the REST Json service that returns the "recent activity".

How could I get the number of elements returned by the service in Javascript?

Thank you!

Vincent7036552
Posts: 0
Joined: Mon Aug 11, 2014 10:32 am

Hide components when empty list

Ok I found the solution : when you execute Javascript after a service you have the "data" argument passed to the function. So I counted the items in the data object.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Hide components when empty list

Hello Vincent,

Thank you for feedback, glad it works!

Return to “Issues”