Yan Yi
Posts: 0
Joined: Sat Jan 25, 2014 7:38 pm

empty data set

My app shows a list of contact information. If the list is empty, the user sees a message telling them to add more contacts.

First, I created a label, with the text "Contact list empty. Add more contacts". Visible checkbox is unchecked.

When listService is invoked on PageShow, on success run javascript

codeif (data.length == 0) {
$("#Status_empty_label1").addClass("emptyDataSet");
}/code

CSS asset:

code.emptyDataSet {
visibility: visible;
}/code

This does not work.

I tried doing it the opposite way by checking the visible checkbox and using CSS asset
code.emptyDataSet {
visibility: hidden;
}/code
and javascript
codeif (data.length != 0) {
$("#Status_empty_label1").addClass("emptyDataSet");
}/code and it works.

My question is how do I do it using the first method? The second method is ugly because the text is visible for a split second before the javascript is executed to hide visibility.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

empty data set

Hi Yan,

First of all, you use a wrong property (visibility). Use "display" instead.

Second of all, it's recommended to use component name.
Image

Correct code:
pre

Appery("label_Status_empty_label1").show();/pre

Note: label_Status_empty_label1 - is label name.

Otherwise, if you want to do it with CSS rule you should use the following :
pre

div.label_Status_empty_label1{
display: block;}/pre

Return to “Issues”