Friday, January 16, 2009

Partial Page Refresh ($a_report) and jQuery 1.3 new methods LIVE/DIE

If you are using "Partial Page Refresh" to navigate through the pages of a report, the new methods live and die should be useful.

The "Partial Page Refresh" functionality uses the JavaScript function $a_report to request the report's body and then refresh the report without refreshing the whole page (AJAX).

Before, we were able to bind a click event to DOM elements. The click event was not propagating itself to new DOM elements created dynamically after the bind action.
For example: if you bind the click event to every rows of your report, you have to bind the click event to new rows generated after calling the function $a_report.

Now, we are able to bind a live event to our DOM elements. The click event is now able to propagate itself to new DOM elements created dynamically after the bind action.

You can try a working example of jQuery Event Live in APEX.

Happy Web 2.0 coding! :)

3 comments:

dmcghan said...

Louis-Guillaume,

This is absolutely brilliant. I remember talking to Carl about some kind of call back functionality to get this fixed. jQuery to the rescue!

Thanks for the heads up, I'll begin using this immediately.

Regards,
Dan

Patrick Wolf said...

Yes that's really a great function in the new jQuery version!

Thanks for pointing out!
Patrick

Louis-Guillaume Carrier-Bédard said...

Nice to hear from you guys!
Tell me if you have troubles updating from 1.2.6 to 1.3

I came across problems with jQuery UI.