- This topic has 5 replies, 4 voices, and was last updated 11 years, 3 months ago by support-octavio.
-
AuthorPosts
-
paulDMemberHi everyone,
I’m trying to get this to work, but as always its not going to plan 🙂
I want to be able to push a button which will deselect the selected items of a list. I’ve been trying this from the list widgets snippets but have added the selected false bit instead of the log of the val.
$('select[name="list1"] :selected').each( function(i, selected) { $(selected).prop("selected", false); } )
It doesn’t work you won’t be surprised to know…. Javascript hates me… Anyway I know the array works as i can log the selected items values. Its the prop bit which doesn’t fire, it doesn’t fire an error in the debugger, just doesn’t fire.
Thanks for any help
Paul
Attachments:
You must be logged in to view attached files.
Stu WadeMemberHi Paul,
Here’s the solution, from Octavio I think …
$(‘#m1-page-selectListItem’+j).removeClass(m1Design.css(‘selected’));
Where j runs through the list, does no harm if item is unselected.
I had exactly the same problem…
support-octavioMemberHi Paul,
Please try the snippet of code I shared in this thread: http://www.genuitec.com/support-genuitec/viewtopic.php?p=8909#p8909
Let me know if you need further assistance.
Paul_paulParticipantCincy Planet shared this code with me it works fine.
$('.m1-selection-list > li').each(function (i) { $(this).removeClass(m1Design.css("selected")); }); phoneui.preprocessDOM();
paulDMemberGreat stuff guys. Works a treat! Thanks for your input
Just in case anyone else in the future needs to do this –
For deselecting a specific list in the project just change ‘m1-unselect-list1’; to your list ID
var selListId = 'm1-unselect-list1'; var listName = 'list1'; var itemToSelect = $('select[name='+listName+'] :selected').prop("selected", false); var selId = $('#' + selListId + '> li').each( function (i) { $(this)[i == itemToSelect ? 'addClass' : 'removeClass'](m1Design.css("selected")); }); // This line updates hidden select, for the case the whole // design will be used as a form phoneui.preprocessDOM('#' + selListId);
for every list in the project its a little simpler –
$('.m1-selection-list > li').each(function (i) { $(this).removeClass(m1Design.css("selected")); }); phoneui.preprocessDOM();
this topic is now closed!
support-octavioMemberHi Paul,
I am glad that the snippet code worked for you. Closing thread.
-
AuthorPosts