vendredi 23 janvier 2015

restoring the state of checkboxes from an array of 0 and 1s

I want to restore the state of my checkboxes in an ORACLE APEX tabular form. The selection is made in the first column using the APEX row selector f01.


I saved the checkkboxes state in a collection and from there to an array in a region item called P250_JSON,whereby the value of P250_JSON is a character string: '[1,0,0,1,0,0,0,0,0]' for example if the 1st and 4th row are selected.


From this array [1,0,0,1,0,0,0,0,0]


I want to programatically click on the 1st and 4th row element of a tabular form and restore the original choices when required.


Beginner in Jquery but I got this far:



var x = $v("P250_JSON");
var arrBoxes = jQuery.parseJSON(x);


$.each(arrBoxes,
function(index,val){
$("input[name='f01']").attr("checked","checked");
});


Obviously this checks all the checkboxes,so there is something missing.


Any help appreciated.





Aucun commentaire:

Enregistrer un commentaire