Page 1 of 1
Hide/Remove List Items
Posted: Tue Jun 09, 2015 8:27 pm
by Aeneas McBurney
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?
Hide/Remove List Items
Posted: Wed Jun 10, 2015 9:23 am
by Serhii Kulibaba
Hello Aeneas,
It happens because you remove all components, including template components.
Hide/Remove List Items
Posted: Thu Jun 11, 2015 9:47 pm
by Aeneas McBurney
But why does the hide() behave differently and only hide the ones matching the contains criteria?
Hide/Remove List Items
Posted: Fri Jun 12, 2015 1:07 pm
by Serhii Kulibaba
Could you send us screenshots with these components. Which of them are created via service, which not? And which do you need to hide?
Hide/Remove List Items
Posted: Mon Jun 15, 2015 8:11 pm
by Aeneas McBurney
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.
Hide/Remove List Items
Posted: Tue Jun 16, 2015 5:38 pm
by Serhii Kulibaba
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.
Hide/Remove List Items
Posted: Wed Jun 17, 2015 1:21 am
by Aeneas McBurney
So the remove() ignores the contains filter and the hide() does not?
Hide/Remove List Items
Posted: Thu Jun 18, 2015 5:22 pm
by Serhii Kulibaba
I am sorry, not sure I understand you correctly. Please specify your question.