1
Help for ParamQuery Select / Refresh the pqSelect list after an update
« on: April 07, 2015, 02:09:23 pm »
Hi,
I need you help again
I need to change the list of options of my element but I can't refresh the pqSelect list
When I load my page I run the function onload with a default list of options :
function onload() {
$("#identification_photographe").pqSelect({
multiplePlaceholder: 'Sélectionner les photographes',
deselect: true,
selectallText: 'Tout cocher',
checkbox: true,
maxSelect: 10,
maxDisplay: 10,
search: true
}).on("change", function(evt){
//var val = $(this).val();
//Sauvegarde_Champs(this.name, val, this.id);
});
}
But later on, I need to change the list of options and to refresh the pqSelect list using :
function update() {
....
var oSelect = document.getElementById('identification_photographe'),
opts = oSelect.getElementsByTagName('option');
while(opts[0]) {
oSelect.removeChild(opts[0]);
}
for(i=0; i<tab['photographe'].length; i++) {
oSelect.options[tab['photographe'].no] = new Option(tab['photographe'].prenom + ' ' + tab['photographe'].nom, tab['photographe'].no);
}
$( "identification_photographe" ).pqSelect( "refreshData" );
}
But the pqSelect is not refreshed...
Something that I did not understand.... but what ??
Thank you
Laurent
******************************* I solved it !
I forgot the # character in $( "#identification_photographe" ).pqSelect( "refreshData" );
Thank you anyway !!
I need you help again
I need to change the list of options of my element but I can't refresh the pqSelect list
When I load my page I run the function onload with a default list of options :
function onload() {
$("#identification_photographe").pqSelect({
multiplePlaceholder: 'Sélectionner les photographes',
deselect: true,
selectallText: 'Tout cocher',
checkbox: true,
maxSelect: 10,
maxDisplay: 10,
search: true
}).on("change", function(evt){
//var val = $(this).val();
//Sauvegarde_Champs(this.name, val, this.id);
});
}
But later on, I need to change the list of options and to refresh the pqSelect list using :
function update() {
....
var oSelect = document.getElementById('identification_photographe'),
opts = oSelect.getElementsByTagName('option');
while(opts[0]) {
oSelect.removeChild(opts[0]);
}
for(i=0; i<tab['photographe'].length; i++) {
oSelect.options[tab['photographe'].no] = new Option(tab['photographe'].prenom + ' ' + tab['photographe'].nom, tab['photographe'].no);
}
$( "identification_photographe" ).pqSelect( "refreshData" );
}
But the pqSelect is not refreshed...
Something that I did not understand.... but what ??
Thank you
Laurent
******************************* I solved it !
I forgot the # character in $( "#identification_photographe" ).pqSelect( "refreshData" );
Thank you anyway !!