ParamQuery grid support forum

General Category => Help for ParamQuery Select => Topic started by: rsgmedia on October 23, 2016, 09:37:42 am

Title: pqSelect Select Items dynamically
Post by: rsgmedia on October 23, 2016, 09:37:42 am
We are using PqSelect multiselect with checkboxes.  I am able to get the selected values as an array if id's. I want to select items of pqselect using an array of id's I am getting from my DB. How can I do that?

Code Snippet:
//To Get
var agencies = $('#ddlAgencies').val();
//output [12,23];
//To Set
var agencies = [12,23,34];
$('#ddlAgencies').val(agencies);

When I Set pqSelect using above statement it doesn't give me any error but do not select the desired values
Title: Re: pqSelect Select Items dynamically
Post by: paramvir on October 24, 2016, 12:09:48 pm
refreshData() needs to be called after that.

$('#ddlAgencies').pqSelect( "refreshData" );

http://paramquery.com/pro/api/select#method-refreshData
Title: Re: pqSelect Select Items dynamically
Post by: rsgmedia on October 27, 2016, 10:15:07 am
Thanks it worked well!!