jeudi 12 février 2015

Customize drop down list with jquery



I'm using SharePoint 2010 and trying to limit the choices in SharePoint SpListFilterWebPart filter, using jquery. The filter has around 40 values to choose from (stored in SharePoint as list), but certain users should see only 2-4 items in that filter. At first I had tried to use different types of drop-down lists (ASP dropdown, HTML dropdown, content editor) and just build a new dropdown with 2-4 items for those users, but the problem I run into - all of those options had connectivity grayed out and I need to connect that web part with few others and pass user's choice as a parameter. So now I'm trying to find a way to hide/remove the items in the filter. Most of the codes that I found for jquery are apply to the dropdown lists I mentioned above. Is there a way to hide the items from SharePoint filter web part? I had setup the part of reading the values that should be in the drop-down list/filter choice from URL (using jquery) and now pretty much stuck.


I'm also experiencing the problem with referring to SpListFilterWebPart, as I have 2 of SP filters on the same page and can't refer to it as SpListFilterWebPart. Tried the ID - also no luck. Please advise... Maybe there is a different way of resolving it - please let me know!


Here are couple of the commands I tried without any success:



$("select[Title='Selected values']").find("option[value='06']").hide();
$(":input[title='Selected values']").find('option:contains(Beach)').remove();


Thank you!








0 commentaires:

Enregistrer un commentaire