paramquery / select

jQuery select plugin
GNU General Public License v3.0
25 stars 21 forks source link

use jquery/javascript in pqselect #15

Open tranvietha opened 8 years ago

tranvietha commented 8 years ago

Dear everyone,

I have used pqselect for my website. It works very good but I have 2 question need your help.

First, how can i disable several option? Second, how can i select several option after select control was created?

This's my jquery code:

$("#selectUserSameRole").append(optListUser); //variable "optListUser " I get from server. $("#selectUserSameRole").pqSelect({ multiplePlaceholder: '-- Select user --', checkbox: true //adds checkbox to options }).on("change", function(evt) { var val = $(this).val(); document.getElementById('lstSelectedSameRole').value = val; }).pqSelect('open');

Tks all.

paramquery commented 8 years ago

1) add disabled attribute to the options.

2) $( ".selector" ).val( array of selected options );

Do refreshData http://paramquery.com/api/select#method-refreshData