Prototype Helper Method Name Clash

Hi,

I am using Open Flash Charts (http://teethgrinder.co.uk/open-flash-
chart/) in a rails project.

Once the flash movie is loaded the dom element of the movie supports a
javascript function called “reload” to allow you to get the flash
movie to reload a url that supplies chart data. This is a cool
feature and I want to use it to make switching between chart data
really responsive.

I have set up some link_to_remote links that call a controller method
that contains a simple inline rjs statement to call the “reload”
function on the dom id of the flash movie:

def reload_data
render(:update) { |page|
page[params[:chart_id]].reload(params[:data_path])}
end

This is where I found that the JavaScriptElementProxy class in the
prototype helper contains a “reload” method - which hides the native
reload function on the dom element.

My question: How can I bypass the JavaScriptElementProxy methods
without hacking the ActionPack code.

Of course I could skip the Ajax links and just do pure client side
onclick events, but I would like to know how do deal with the issue I
have found.

Thanks in advance rail dudes…

James

use direct javascript

page<<“$(‘chart_id’).reload(#{params[:data_path])})”

try using “call”,

call(function, *arguments, &block)

Calls the JavaScript function, optionally with the given arguments.

If a block is given, the block will be passed to a new
JavaScriptGenerator; the resulting JavaScript code will then be wrapped
inside function() { … } and passed as the called function‘s final
argument.

jrm wrote:

Hi,

I am using Open Flash Charts (Open Flash Chart – Teeth Grinder UK
chart/) in a rails project.

Once the flash movie is loaded the dom element of the movie supports a
javascript function called “reload” to allow you to get the flash
movie to reload a url that supplies chart data. This is a cool
feature and I want to use it to make switching between chart data
really responsive.

I have set up some link_to_remote links that call a controller method
that contains a simple inline rjs statement to call the “reload”
function on the dom id of the flash movie:

def reload_data
render(:update) { |page|
page[params[:chart_id]].reload(params[:data_path])}
end

This is where I found that the JavaScriptElementProxy class in the
prototype helper contains a “reload” method - which hides the native
reload function on the dom element.

My question: How can I bypass the JavaScriptElementProxy methods
without hacking the ActionPack code.

Of course I could skip the Ajax links and just do pure client side
onclick events, but I would like to know how do deal with the issue I
have found.

Thanks in advance rail dudes…

James