Hi,
I’m trying to add/remove section on the timeline view through checkbox.
I was able to add and remove sections but can not get the variables and I don’t know what worng…
This is my JS code
var filter_inputs = document.getElementById("filter-sections").getElementsByTagName("input");
for (var i=0; i<filter_inputs.length; i++) {
var filter_input = filter_inputs[i];
filter_input.onchange = function() {
var display = $('input:checkbox:checked.group1').map(function (item) {
return {
key: item.key,
label: item.label
};
}).get();
var serialized = display;
//update timeline reloads options and redraws the view
scheduler.updateCollection("sections", serialized);
alert(serialized);
}
}
This is the Html
<div class="filter-sections" id="filter-sections">
<span><strong>Section:</strong></span><br>
<input type="checkbox" class="group1" data-key="1" data-label="Test Name" checked="checked"/>
<input type="checkbox" class="group1" data-key="2" data-label="Test Name" />
<input type="checkbox" class="group1" data-key="3" data-label="Test Name" />
<input type="checkbox" class="group1" data-key="4" data-label="Test Name" />
<input type="checkbox" class="group1" data-key="5" data-label="Test Name" checked="checked" />
<input type="checkbox" class="group1" data-key="6" data-label="Test Name" checked="checked" />
<input type="checkbox" class="group1" data-key="7" data-label="Test Name" checked="checked" />
<input type="checkbox" class="group1" data-key="8" data-label="Test Name" />
<input type="checkbox" class="group1" data-key="9" data-label="Test Name" />
<input type="checkbox" class="group1" data-key="10" data-label="Test Name" />
<br>
</div>
For some reason i get all the time undefined