FIX #502: Possibility to choose 'no selection' in session log form

Ref #501...may help/fix this...uncertain yet. Need to finish writing the relevant test!
This commit is contained in:
2022-10-23 10:52:55 +01:00
parent 7526485837
commit 259932a548
9 changed files with 118 additions and 28 deletions

View File

@@ -47,14 +47,16 @@ function initPicker(obj) {
//log: 3,
preprocessData: function (data) {
var i, l = data.length, array = [];
array.push({
text: clearSelectionLabel,
value: '',
data:{
update_url: '',
subtext:''
}
});
if (!obj.data('noclear')) {
array.push({
text: clearSelectionLabel,
value: '',
data:{
update_url: '',
subtext:''
}
});
}
if (l) {
for(i = 0; i < l; i++){
@@ -71,11 +73,13 @@ function initPicker(obj) {
return array;
}
};
obj.prepend($("<option></option>")
.attr("value",'')
.text(clearSelectionLabel)
.data('update_url','')); //Add "clear selection" option
console.log(obj.data);
if (!obj.data('noclear')) {
obj.prepend($("<option></option>")
.attr("value",'')
.text(clearSelectionLabel)
.data('update_url','')); //Add "clear selection" option
}
obj.selectpicker().ajaxSelectPicker(options); //Initiaise selectPicker