Thank you very much, implementing the <filter-menu> did exactly what I
was looking for,

it's a shame that the filter resets to the default option , once the
re-render has finished (is there a way to set this every time a new
option is selected)?
However this is a very minor issue, and this does exactly what I want,

Thanks again!

Pete

On Nov 18, 5:20 pm, kevinpfromnm <[email protected]> wrote:
> If you're willing to do a full render, just use the filter-menu tag
> for your select.  Way simpler than anything else.  Your controller
> code can remain the same and your view will just betable-plus (minus
> the part attribute) and the filter-menu.
>
> On Nov 18, 3:23 am, Pete <[email protected]> wrote:
>
>
>
> > Thanks again for your reply,
>
> > Yes, that is exactly what I'm trying to so, refresh part of the page,
> > after selecting a specific option in the drop-down menu. And yep, I am
> > just looking at choosing between views of All and Latest.
>
> > Sorry, my naming was perhaps a little ambiguous!
>
> > I have added the <do> section wrapped around mytable, but theupdate/
> > refresh does not seem to be happening still.
>
> > I think what is happening, is when I select :update=>
> > 'finished_article_table', in an attempt toupdatethis specific part,
> > as I have also used :with => 'Form.Element.Serialize(this)', the
> >updateis just using the string of 'this' context, so am just shown a
> > page with 'Latest' text at the top. (or 'All' depending on the
> > selection)
>
> > What I think I need to to, is: because this value is being passed back
> > to the controller to instantiate the @myOption instance variable, and
> > therefore select different options through my chained named_scope, I
> > think I would then need to re-render the page with these new options -
> > a complete re-render would be perfectly fine, as long as the selected
> > variable was still being passed to build the correcttable-plus,
>
> > Is there a page re-render option I can call in the controller, which
> > will build the new page based on current options?
>
> > Thanks again
>
> > Pete
>
> > On Nov 18, 12:22 am, kevinpfromnm <[email protected]> wrote:
>
> > > ok, so I'm fully clear, this is an index view that you want to be able
> > > to switch between viewing latest and viewing all with an ajaxupdate
> > > rather than re-rendering the page?  Some of the naming was throwing me
> > > off assuming that's the case.
>
> > > Try something like this.
>
> > > <do part='finished_article_table' part-locals="@page">
> > >   <table-plus with="&page" fields="page, created_at" >
> > >   </table-plus>
> > > </do>
>
> > > I think what's going on, is it's not using the updated context (which,
> > > this still might not get it there) because it's passed as an instance
> > > variable.  I'm not sure by any means but maybe it will get you going
> > > again.
>
> > > On Nov 17, 1:09 pm, Pete <[email protected]> wrote:
>
> > > > ... sorry again (what am I doing.... long day!)
>
> > > > :update=> 'finished_article_table'
>
> > > > On Nov 17, 8:06 pm, Pete <[email protected]> wrote:
>
> > > > > yep, sorry! it is a typo should be :update=>
> > > > > '''inished_article_table'
>
> > > > > this was correct in my code, just a typo here........
>
> > > > > On Nov 17, 7:40 pm, kevinpfromnm <[email protected]> wrote:
>
> > > > > > Is :update=> ''finished_article_table' a typo?  mismatched quote
> > > > > > types.
>
> > > > > > On Nov 17, 8:15 am, Pete <[email protected]> wrote:
>
> > > > > > > Thanks Kevin,
>
> > > > > > > The part mechanism certainly seems like a good logical step in
> > > > > > > updating specific sections of the page, I like it! :)
>
> > > > > > > I had a look at a lambda in the named scope, but this seemed to
> > > > > > > restrict what I was trying to achieve with my particular models 
> > > > > > > and
> > > > > > > fields.
>
> > > > > > > What I have managed to build so far is:
>
> > > > > > > my controller method -----
>
> > > > > > > def finishedArticle
>
> > > > > > >     �...@myoption = params[:stateSelect]
>
> > > > > > >               if @myOption == 'Latest'
>
> > > > > > >             �...@page =
> > > > > > > Page.finished_pages.latest_finished.apply_scopes( :search =>
> > > > > > > [params[:search], :page, :created_at ], :order_by =>
> > > > > > > parse_sort_param(:page, :created_at )).paginate(:per_page => 25, 
> > > > > > > :page
> > > > > > > => params[:page])
>
> > > > > > >              else
>
> > > > > > >             �...@page = Page.finished_pages.apply_scopes( :search 
> > > > > > > =>
> > > > > > > [params[:search], :page, :created_at], :order_by =>
> > > > > > > parse_sort_param(:page, :created_at :)).paginate(:per_page =>
> > > > > > > 25, :page => params[:page])
>
> > > > > > >              end
> > > > > > > end
>
> > > > > > > Then in my view for finished Articles, I have:
>
> > > > > > > <%= select_tag "stateSelect", options_for_select(['All', 
> > > > > > > 'Latest'],
> > > > > > > 'All'),  { :onchange => remote_function(
> > > > > > >                  :update=> 'finishedArticles',
> > > > > > >                  :with => 'Form.Element.serialize(this)',
> > > > > > >                                  :url => {:action =>
> > > > > > > 'finishedArticles'})    } %>
>
> > > > > > > <table-plus part='finished_article_table' with="&@page 
> > > > > > > fields="page,
> > > > > > > created_at" >
> > > > > > > </table-plus>
>
> > > > > > > I feel like I am almost there with what I am trying to achieve, 
> > > > > > > the
> > > > > > > webpage loads initially with all of the finished articles showing 
> > > > > > > in
> > > > > > > thetable, and when I use the select menu, to choose 'Latest, I can
> > > > > > > see from the console that the correct data is extracted from the
> > > > > > > database - and has picked up the chained named scope - (if 
> > > > > > > @myOption =
> > > > > > > 'Latest' .... Page.finished_pages.latest_finished), however, I 
> > > > > > > cannot
> > > > > > > get the contents of thetabletoupdate. If I change :update=>
> > > > > > > 'finishedArticles', to :update=> ''finished_article_table', I get 
> > > > > > > a
> > > > > > > blank page with the text 'Latest' shown in the top corner?
>
> > > > > > > I have thought about trying to use render :updatedo |page|
> > > > > > > page.replace_html, 'theTable' 'relevant code to replacetable'-  
> > > > > > > but I
> > > > > > > am unsure how to call the html correctly here to render the 
> > > > > > > changed
> > > > > > >tableon the webpage?
>
> > > > > > > Any help here would be greatly appreciated!
>
> > > > > > > Thanks again
>
> > > > > > > Pete
>
> > > > > > > On Nov 12, 11:15 pm, kevinpfromnm <[email protected]> wrote:
>
> > > > > > > > I'm thinking, move the option list to a named_scope that takes 
> > > > > > > > an
> > > > > > > > argument, then something like:
>
> > > > > > > > <table-plus with="&ModelName.by_state(@my_option)"
> > > > > > > > part="table_by_state">
>
> > > > > > > > Then you should be able to use hobo's part mechanism but you'll 
> > > > > > > > have
> > > > > > > > to poke a little to see how to make itupdatea part from JS.
>
> > > > > > > > On Nov 12, 3:54 am, Pete <[email protected]> wrote:
>
> > > > > > > > > Hi,
>
> > > > > > > > > I am trying toupdatea page I have which displays atableof 
> > > > > > > > > data,
> > > > > > > > > but which I would like to dynamicallyupdatedepending on what 
> > > > > > > > > is
> > > > > > > > > selected in the <select-input> field.
>
> > > > > > > > > I have a controller with a method containing thetableplus 
> > > > > > > > > info - but
> > > > > > > > > in my view, I would like to dynamically change the content of 
> > > > > > > > > the
> > > > > > > > >tableplus, I would imagine I could change something here.......
>
> > > > > > > > > <table-plus with="&@myOption" fields="field1, field2etc" >
>
> > > > > > > > > where myOption is the result of the select-input field,
>
> > > > > > > > > <select-input options"&[['Latest', '@latestFinished'], ['All',
> > > > > > > > > '@allFinished'] ]", onchange="upd...@myoption" />
>
> > > > > > > > > @latestFinished, and @allFinished are defined in my 
> > > > > > > > > Controller using
> > > > > > > > > my own named_scopes to gather the relevant data. I realise my 
> > > > > > > > > select
> > > > > > > > > input is probably completely wrong, but is there something 
> > > > > > > > > along these
> > > > > > > > > lines that will work?- Hide quoted text -
>
> > > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to