You could look at this project:

http://code.google.com/a/apache-extras.org/p/ajax4click/

Basically upon for Ajax requests it switches off the DOM ready function (the addLoadEvent function is not rendered) and then execute the <script> body using jQuery:

jsScript.setExecuteOnDomReady(false);

regards

Bob

On 2011/07/14 16:02 PM, Hans C. Poo wrote:
Bob,

Hi, some time ago we moved to using jQuery with noConflict, and is working fine 
with click and prototype. It forces us to rewrite copied code replacing dollar 
sign $ with for instance jQuery as the name of the global variable, but works.

Our current problem is that our interface manages controls in a very generic way and 
don't know what type of control it's handling, it may be useful to be able to render the 
precise javascript code needed to "activate" the field without all the import 
stuff, obviously assuming that the needed css or javascripts are already loaded.

Thanks
Hans

Hans Poo, Welinux S.A.
Bombero Ossa #1010, oficina 800,
+56-2-3729770, Movil: +56-9-3199305
Santiago, Chile


----- Mensaje original -----
De: "Bob Schellink"<[email protected]>
Para: [email protected]
Enviados: Jueves, 14 de Julio 2011 4:11:24
Asunto: Re: Initialisation of dynamic added date fields

Hi,

Click's DateField uses Prototype.js library. I wouldn't mix Prototype
and jQuery. Rather use Click-calendar[1].

regards

Bob

[1]: http://code.google.com/a/apache-extras.org/p/click-calendar/

On 2011/07/13 19:15 PM, Hans C. Poo wrote:
Hi,

We are building a very dynamic data entry system that requires adding fields on 
the fly.

Specially we have some sections we are calling "grid".

Each row of these grids is a set of fields that replicate from the fields of 
row zero, there is a button to add new rows.

Initially we used some jquery to clone rows, rename fields, and worked fine, 
but the initialisation of dateFields was missing, we are mounting all the 
application on click fields and eventually other controls may get broken too, 
at this time we considered  to manually call the javascript binding code of the 
dateField, but we considered it too obtrusive, and decided to resource to Ajax 
and created a handler that only returned one row at a time, velocity code:

$imports

<tr>
        #foreach( $field in $fields )
                <td>$field</td>
        #end
</tr>

Then we included in the response the $imports, and in fact the javascript code 
for the dateField was there but with a lot o baggage, and were too much and the 
page loose the format.

Finally we agree that we need only the javascript initialisation (binding) code 
of the dateField: Event.observer ..., it wasn't possible because but it was 
inside the protected method addCalendarOptions(..).

We don't want to broke the API or begin to clone javascript code, is there a 
way to accomplish this in some more standard way.

Note: Due to the nature of the system we were not able to use FormTable, that 
was the most similar thing we found on apache click space.

Thanks
Hans



Reply via email to