Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Hide/Remove List Items

I have this code that works to hide empty list items

list.find("[name=mobilegridcell_255]:contains(emptylabel)").closest('[name=listPreviousInvoicesItem]').hide();

This hides the last row which contains an unmapped list item. However when I run the same for remove it removes all of the list items

list.find("[name=mobilegridcell_255]:contains(emptylabel)").closest('[name=listPreviousInvoicesItem]').remove();

Can you tell me why?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hide/Remove List Items

Hello Aeneas,

It happens because you remove all components, including template components.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Hide/Remove List Items

But why does the hide() behave differently and only hide the ones matching the contains criteria?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hide/Remove List Items

Could you send us screenshots with these components. Which of them are created via service, which not? And which do you need to hide?

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Hide/Remove List Items

HI, I need to remove the blank row at the end but because remove() deletes them all I have to use hide(). I'm just asking why they have different behaviours.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hide/Remove List Items

The last blank component is the template for components which are created via mapping. It is invisible, so if you hide it - it remains on the page, but if you remove it - it also removes components which are created via mapping.

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Hide/Remove List Items

So the remove() ignores the contains filter and the hide() does not?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hide/Remove List Items

I am sorry, not sure I understand you correctly. Please specify your question.

Return to “Issues”