I am looking for a way to dynamically bind formulas throughout my DOM.
We have a data intensive app, and currently I write many handlers to try and recalculate and updat
You can approach the problem like this:
$('myDomElement').data('varX',data);
$("myDomElement").bind("setData", function(key,value){
setTimeout(function() { $("myDomElement").trigger("formula"); },10);
return value;
});
$('myDomElement').bind("formula",function() { this.html(foo()); });
Woehoe, I reread your post and found you don't really specify you have vars in which you store the data ... instead you got cells ...
hmmm, actually, I think I forgot what the problem was, it seems a bit too obvious what I'm supposing here ... sorry if of no help
anyway ... I did a quick google on data binding jquery, that's where I found you can bind the setData/getData-events on $.data: What you might not know about jquery
I also found this, which might or not be of interest to your spreadsheety-approach: using jquery.data to detect form changes
What's more, I agree with previous answers, you could always use a framework -- personally I prefer jsmvc