ChooseFromGrid broken
updateChoice
tasks with ChooseFromGrid
causes a client-side exception: TypeError: Cannot read property 'classList' of undefined
. This happens in initDOMEl
of the grid component:
if(me.attributes.value.length) {
me.attributes.value.forEach(function(selectedIdx) {
bodyEl.childNodes[selectedIdx].classList.add(me.cssPrefix + 'selected');
});
}
The problem appears to be that me.attributes.value
contains the choice IDs (hashed JSON representations determined by genChoiceID
) while this code expects plain indices.
It seems that me.select(me.attributes.value, false);
should be used instead of the snippet above, as is done in the other choice components.
MWE:
import iTasks
Start w = doTasks (updateChoice [ChooseFromGrid id] [1,2,3] 1) w
Edited by Camil Staps