List Info

Thread: REPLACE content in a div on prototype observe_field update?




REPLACE content in a div on prototype observe_field update?
country flaguser name
United States
2007-09-20 01:43:02
I'm trying to implement a select/option filter to display a
list on a
page.  I'm using observe_field to execute a controller
action
(update_job_list), which then calls render
:partial=>"job_listings" in
the div to be updated.

The problem is that the list of jobs generated by the
partial inserts
above, below, top, or bottom depending on the :position
option.  But I
would like to REPLACE the part of the page (div) being
updated, not
insert the new list in addition to the existing content in
the div.
Any idea how to replace the content?

Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


Re: REPLACE content in a div on prototype observe_field update?
country flaguser name
United States
2007-09-20 21:20:16
Going out on a limb here and assuming that you're using
rjs?

Use .replace_html('element_id', rendering_options) rather
than .insert_html(:positoin, 'element_id',
rendering_options)

On Sep 20, 2:43 am, athem <allan.m.mil...gmail.com> wrote:
> I'm trying to implement a select/option filter to
display a list on a
> page.  I'm using observe_field to execute a controller
action
> (update_job_list), which then calls render
:partial=>"job_listings" in
> the div to be updated.
>
> The problem is that the list of jobs generated by the
partial inserts
> above, below, top, or bottom depending on the :position
option.  But I
> would like to REPLACE the part of the page (div) being
updated, not
> insert the new list in addition to the existing content
in the div.
> Any idea how to replace the content?
>
> Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


Re: REPLACE content in a div on prototype observe_field update?
country flaguser name
United States
2007-09-21 10:43:37


On Sep 20, 7:20 pm, AndyV <a...cornell.edu> wrote:
> Going out on a limb here and assuming that you're using
rjs?

I'm using pototype, but looks like rjs has a possible
solution.
Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


Re: REPLACE content in a div on prototype observe_field update?
country flaguser name
United States
2007-09-21 14:52:46
rjs is built on scriptaculous/prototype so it's all one and
the same.

Try $('your_div').replace(new_html);

Or

new Ajax.Updater('your_div',
'url_to_action_rendering_the_partial');

On Sep 21, 11:43 am, athem <allan.m.mil...gmail.com> wrote:
> On Sep 20, 7:20 pm, AndyV <a...cornell.edu> wrote:
>
> > Going out on a limb here and assuming that you're
using rjs?
>
> I'm using pototype, but looks like rjs has a possible
solution.
> Thanks.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails" group.
To post to this group, send email to rubyonrailsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-unsubscribegooglegroups.com
For more options, visit this group at http://gro
ups.google.com/group/rubyonrails
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )