you need to store the info somehow. when you submit, you're only submitting one parameter and the other will reset
On Jun 3, 1:04 pm, Togg <[email protected]> wrote: > Still have troubles to get the range working. I can select one of the > dates, but when I do it will forget the other date selection. > E.g. if I set the selection of the beginning of date range > (startdate), then afterwards the end and submit the form, it will > remove the startdate > > The calendar_date_select_tag is basically a input form with > "name=startdate" or "enddate" > > View: > > <td>Birthday Between</td> > <td class="left"> > <form action="&request.request_uri" class="filter-menu" > method="get"> > <div> > <%= calendar_date_select_tag "startdate", > params[:startdate], > :year_range => 15.years.ago..0.years.ago, > :valid_date_check => "date < (new Date()).stripTime()" > %> > </div> > </form> > </td> > <td class="right">And</td> > <td> > <form action="&request.request_uri" class="filter-menu" > method="get"> > <div> > <%= calendar_date_select_tag "enddate", > params[:enddate], > :year_range => 15.years.ago..0.years.ago, > :valid_date_check => "date < (new Date()).stripTime()" > %> > </div> > </form> > </td> > > Controller: > def index: > @sel_startdate = params[:startdate] || 1.year.ago.strftime("%Y-%m- > %d") > @sel_enddate = params[:enddate] || Time.now.strftime("%Y-%m-%d") > hobo_index Person.apply_scopes(.............. > :birthday_start_between => > [...@sel_startdate, @sel_enddate]), :per_page => params[:per_page] || 50 > end > > Thanks a lot, > Sebastian > > On 31 Mai, 03:05, Bryan Larsen <[email protected]> wrote: > > > filter-menu is based on select-menu which always generates a single > > <select> -- it doesn't use polymorphic inputs. Such a tag would > > probably be useful, and not too hard to write using thefilter-menu > > source as an example. In your case, you'd need an explicit submit > > button sincedateinputs have more than one input. filter-menu itself > > using a small snippet of code in hobo-rapid.js to auto-submit. > > > apply_scopes does appear to be missing documentation, other than a > > mention in the agility tutorial. Please raise a bug so we don't forget > > to add it. > > > Bryan > > > On 10-05-30 09:36 AM, Togg wrote: > > > > Still no glue here. Can I even use<filter-menu> tofilteradate/ > > > datetime field or do I have to rewrite some tag? > > > I just need a quick pointer were to look at - is there some example > > > somewhere fordatefiltering with table-plus? > > > > Thanks, > > > Sebastian > > > > On 29 Mai, 18:17, Togg<[email protected]> wrote: > > >> Hi all, > > > >> I have a field birthday_at in my model and want to add afilterto my > > >> table-plus to allow selection of a range. > > > >> Tried to add > > >> hobo_index Person.apply_scopes(:search => > > >> [params[:search], :first_name, :last_name], > > >> :order_by => > > >> parse_sort_param(*standard_fields(model)), > > >> :birthday_between => > > >> [params[:start],params[:end]]) > > >> to my controller as hobo_index action and > > > >> <div class="filter"> > > >> Filterby > > >> Birthday Between:<filter-menu param-name="start" > > >> options="#{10.years.ago}" /> > > >> And:<filter-menu param-name="end" options="#{Time.now}" /> > > >> </div> > > >> to the index.dryml for this model. > > > >> Thefilteris displayed as a simple selection box with only "All" > > >> available... > > >> How can I get thedateselector field automatically be added? > > > >> Best regards, > > >> Sebastian > > > >> P.S. I tried to find documentation for apply_scopes, but > > >> athttp://cookbook.hobocentral.net/manual/scopesIcouldntfind it. > > -- 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.
