I have a navbar with 2 entries. One entrie is a checkbox and the other one is a dropdown with a button (I will provide code for that). The input
has the id inputMode
and the button addNewObject
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li id="editMode">
<a href="#">
<label><input type="checkbox" value="Edit Mode" id="inputMode">Edit Mode</label>
</a>
</li>
<li><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-haspopup="true" aria-expanded="false">Scenegraph <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><div style="text-align:center;">
<input id="addNewObject" type="button" class="btn-success" value="Add Object">
</div></li>
</ul>
</li>
</ul>
</div>
For each of the id's i have click
function's.
'click #inputMode': function (event, tmpl) {
let isChecked = $("#inputMode").is(":checked");
if (isChecked) {
// do something
} else {
//do something
}
},
'click #addNewObject': function (ev) {
Helper.initSceneGraph();
}
So the thing is when i click the button addNewObject
the navbar gets rerendered, like this:
static initSceneGraph() {
if (Meteor.isClient) {
Template.sceneGraph.helpers({
sceneObjects: Application.getInstance().scene.sceneObjects,
isAudio: function (obj) {
return obj._soundPath;
}
});
}
UI.render(Template.sceneGraph, document.body);
}
So after the initSceneGraph
the checkbox inputMode
doesnt change. That means visually it changes, but intern it always stays the same. For exampleconsole.log($("#inputMode").is(":checked");
is either ALWAYS false or ALWAYS true, depending if it was true or false BEFORE clicking the button.
I hope someone can help me out with this!
Aucun commentaire:
Enregistrer un commentaire