Author Topic: pqSelect Select Items dynamically  (Read 4222 times)

rsgmedia

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
pqSelect Select Items dynamically
« 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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: pqSelect Select Items dynamically
« Reply #1 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

rsgmedia

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: pqSelect Select Items dynamically
« Reply #2 on: October 27, 2016, 10:15:07 am »
Thanks it worked well!!