Page 1 of 1

Unable to hide empty list items

Posted: Fri Jan 30, 2015 9:00 am
by Fotios Kotsiopoulos

Hi guys,

My application has a collapsibleset with a number of dynamic lists populated by a REST service. Each list item includes a grid with lables.

Image

When the REST service provide a value for eth_type I'm able to detect the undefined values and reduce the size of the list.

Image

I do so by using the following javascript when mapping label text like eth_type

if (typeof value === "undefined")
{
$(element).parent().parent().parent().hide();
}

Image

The problem I have is that when the service doesn't include any response for some labels, the list is displayed empty.

Image

How can I detect and hide these empty lists?


Unable to hide empty list items

Posted: Fri Jan 30, 2015 5:13 pm
by Alena Prykhodko

Hello,

You can add next line:

pre$( ":empty" ).hide();/pre

It can hide more elements then expected, just write your selector before :empty


Unable to hide empty list items

Posted: Fri Jan 30, 2015 10:01 pm
by Fotios Kotsiopoulos

Hi Alena.

Thanks. I can't get this to work as expected.
Should I apply the JS code with the :empty selector at the success mapping service or is it best to apply it once the service is complete and try to target individual selectors?

Regards,
Fotios


Unable to hide empty list items

Posted: Sat Jan 31, 2015 7:16 pm
by Alena Prykhodko

Show us code you use.


Unable to hide empty list items

Posted: Sun Feb 01, 2015 3:06 am
by Fotios Kotsiopoulos

Screenshot attached.

Image


Unable to hide empty list items

Posted: Mon Feb 02, 2015 7:39 am
by Evgene Karachevtsev

Hello Fotios,

Please try to use the element that comes in
pre$(element).hide();/pre


Unable to hide empty list items

Posted: Tue Feb 03, 2015 7:37 am
by Fotios Kotsiopoulos

Still no luck.


Unable to hide empty list items

Posted: Wed Feb 04, 2015 8:37 am
by Maryna Brodina

Hello!

Please try this one pre$(element).closest("[name=mobilelistitem_767]").hide();/pre


Unable to hide empty list items

Posted: Thu Feb 05, 2015 9:29 am
by Fotios Kotsiopoulos

Thanks,

I managed to work around this by defining default text label for
label_eth_type" of "novalue".

When the service completes I run the following code to hide lists that still include the default "novalue" text for label_eth_type.

$('.DisplayDatapathFlowsPage_label_eth_type:contains("novalue")').parent().parent().parent().hide();

Maybe not the best way of doing things but it works.


Unable to hide empty list items

Posted: Thu Feb 05, 2015 9:32 am
by Evgene Karachevtsev

Hello Fotios,

Thank you for the update.