Commit 7038f89a authored by Sven Franck's avatar Sven Franck

jqm_4: fixed recursion

parent bf10906b
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
<body> <body>
<p>HELLO recursive</p> <p>HELLO recursive</p>
<!-- cannot trigger g1 with a regular document binding, because going and forth re-binds into too much recursion--> <!-- cannot trigger g1 with a regular document binding, because going and forth re-binds into too much recursion
<button type="button" onclick="RenderJs.GadgetIndex.getGadgetById('g1').gadget_call1()" value="click me" id="clickediclick" icon="gear" iconpos="left" data-inline="true"/> onclick="RenderJs.GadgetIndex.getGadgetById('g1').gadget_call1()"
-->
<button type="button" value="click me" id="clickediclick" icon="gear" iconpos="left" data-inline="true"/>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//<![CDATA[ //<![CDATA[
......
...@@ -3,4 +3,14 @@ var gadget_call2 = function() { ...@@ -3,4 +3,14 @@ var gadget_call2 = function() {
}; };
var gadget_call4 = function() { var gadget_call4 = function() {
console.log("gadget_call4 registered"); console.log("gadget_call4 registered");
} }
\ No newline at end of file console.log("hello");
var btns = $('#clickediclick');
btns
.filter(function() { return $(this).data("bound") !== true; })
.data('bound', true )
.on('click', function() {
console.log("clicked button");
RenderJs.GadgetIndex.getGadgetById('g1').gadget_call1();
});
...@@ -45,8 +45,11 @@ var RenderJs = (function () { ...@@ -45,8 +45,11 @@ var RenderJs = (function () {
RenderJs.bindReady( RenderJs.bindReady(
function () { function () {
// examine all Intaction Gadgets and bind accordingly // examine all Intaction Gadgets and bind accordingly
$("div[data-gadget-connection]").each(function (index, element) { $("div[data-gadget-connection]")
RenderJs.InteractionGadget.bind($(element)); .filter(function() { return $(this).data("bound") !== true; })
.data('bound', true )
.each(function (index, element) {
RenderJs.InteractionGadget.bind($(element));
}); });
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment