RJS / AJAX question

I have a custom class that is used to generate a report. The process
of generating one line for this report takes anywhere from 1-3 seconds
which can cause the report to take a while to finish running and to
appear on the screen. I have an AJAX timer currently that tells the
user that something is happening but I’m trying to improve this
process. Because of the size of this report it can take up to 1.5
minutes to completely run. My idea was to write something that could
insert each row into the table as it is calculated via RJS / AJAX.
Unfortunately rails seems to wait until all of the requests are built
before sending any of the javascript updates to the browser rather
than sending each update as it happens. Does anyone know of a way
around this behavior so I can flush the updates to the browser?
I’d like to do something like

render :update do |page|
page.toggle 'results, ‘request’
data.each do |row|
page.insert_html(:bottom, ‘table’, calc_row_data(row)
flush_results_to_browser
end
end

Is this possible?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs