top of page
  • Writer's pictureArun Kumar

Display Image if Dataset Count is 0

I have a repeater which is connected to a dataset. I would like to display an image if repeater is not displayed at all. As the repeater is connected to Dataset, it will be displayed if dataset count is 0.


Hide Image Behind Repeater


Set the image you would like to display behind the repeater and set its hidden property so it does not show up on page load.



Write Dataset onReady Event Function


Select the dataset and write the function onReady() event.

You cannot write this function onPage Ready event as dataset is loaded after page is loaded.

Get the total item count from the dataset and check if count = 0, then show the image. Else hide the image

export function dataset1_ready() {
	
	//show the image if dataset is blank
	if ($w('#dataset1').getTotalCount() === 0){
		$w('#launchImg').show();
	}else{
		$w('#launchImg').hide();
	}

}

Cheers!

11 views0 comments

Recent Posts

See All
bottom of page