Cool. Thanks Ken.
I tried out some stuff last night.
Basically I formatted the HTML for the AjaxUpdateContainer to be something like this:
<div data-wonder-id="AUC" data-wonder-options = "{'someKey': 'someValue'}">...</div>
Then I create an on load statement:
$(window).load(function() {
$('[data-wonder-id]').each(function(index, element) {
element = $(element); var type = element.attr('data-wonder-id'); eval(type).initialize(element);
});
});
Then in the AjaxUpdateContainer _javascript_ object I added a method called initialize:
initialize: function(element) { var options = jQuery.parseJSON(element.attr('data-wonder-options')); if(options.hasOwnProperty('minTimeout')) { AUC.registerPeriodic( element, options.hasOwnProperty('canStop') ? options.canStop : null, options.hasOwnProperty('stopped') ? options.stopped : null, options ); } else { AUC.register(element.attr('id'), options); } },
In the event that the AUC is created as part of an Ajax Request I add a little _javascript_ during appendToResponse:
<script>AUC.initialize($("#e_0_15_3_3_1"));</script>
So my thinking is that all the components that need to be initialized when the page gets loaded just need to implement initialize. I guess I should create two options objects one for initialization options and one for ajax options?
best,
Johnny
On May 9, 2013, at 4:36 PM, Ken Anderson < email@hidden> wrote: I think this is awesome! I'm definitely planning on using JQuery within the next few months, and will happily contribute once I get to that point.
Ken On May 9, 2013, at 6:19 PM, Johnny Miller < email@hidden> wrote: Hi Pascal,
I started working on a JQuery framework and I'm up to one component!
You can see it here: http://www.kahalawai.com/JQuery
I'm pretty busy but I think I could make one component a day. I was wondering what people thought about a couple of questions I have:
1. Should I use data attributes? One thing I would like to do is not pollute the HTML with _javascript_ code. Now with my first example (the periodical updater) I'm not sure if that's possible i.e. When the page loads I can find the ajax update containers but what about an ajax update container that is returned from an ajax request? But for a lot of the other components like ajax update link I could just register a trigger using the data attributes.
2. Should I tie the framework to a look like JQueryUI or Bootstrap? Some of the components like date pickers and modal containers need a default styling.
Do you think I should keep on keeping on or has somebody already developed a framework they are about to release or is there a new better idea?
Aloha,
|
Mr. Johnny Miller
Web Development Manager
Kahalawai Media Company
Lahaina, HI 96761
tel: (808) 661-7962 | mobile: (808) 283-0791
website | e-mail
|
|
On Apr 6, 2013, at 1:41 PM, Larry Mills-Gahl < email@hidden> wrote: There was some talk about directing some new development effort toward jQuery in Wonder. I've been working on some bits in this framework and am coming to realize that there are some organizational issues that could go a couple of different directions and I was wondering if there are any forks out there that are working on this that I might pull from and contribute to.
Among the questions that might benefit from some planning are about multiple frameworks and dependencies. Specifically, the ERJQueryMobile framework has jQuery _javascript_ resources and so does the ERJQuery framework (and potentially ERJQueryUI if we decide to separate jQuery from jQuery-UI … which is probably a good idea. Since mobile and UI both depend on jQuery, would it make sense to load those from ERJQuery and update the version handling so that one could load whatever version of jQuery you need. Essentially, making some loader classes in ERJQuery able to load the right version from local resources or a CDN depending on the need.
Anyway… there are a few design decisions that will affect how the framework(s) interact and I wanted to know who else out there had done work on this that I might contribute to.
Thanks.
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|