action_linking into field_search

12 views
Skip to first unread message

Atastor

unread,
Nov 25, 2011, 10:29:08 AM11/25/11
to actives...@googlegroups.com
Given a string column "serial_no" enabled as field_search column.

How do I complete 

conf.columns[:serial_no].set_link :show_search,  ... 

so that clicking in the serial_no column brings me to the search-form pre filled with the value of the records serial_no, or even better, immediately to the search results.

Background: To restrict as-view to records only with a certain serial_no I currently use field-search; this means cut-n-pasting a sn into the field_search forms serial_no textfield and clicking search. It would be easier to simply click the value and getting the same result.

RM

Atastor

unread,
Nov 29, 2011, 11:03:34 AM11/29/11
to actives...@googlegroups.com
Well...not quite what I was looking for and a bit less elegant than hoped for, but working:

    conf.columns[:serial_no].set_link :show_search, :page => false

and in devices_helper:

  def device_serial_no_search_column(record,options)
    if params[:id]
      text_field_tag :serial_no, Device.find(params[:id]).serial_no
    else
      text_field_tag :serial_no, ""
    end
  end

Any hints to improve the search-experience? 

Regards
Michael

Sergio Cambra

unread,
Nov 30, 2011, 3:59:11 AM11/30/11
to actives...@googlegroups.com
On Martes, 29 de noviembre de 2011 08:03:34 Atastor escribió:
> Well...not *quite* what I was looking for and a bit less elegant than hoped

def device_serial_no_search_column(record,options)
options[:value] = Device.find(params[:id]).serial_no if params[:id]
text_field :record, :serial_no, options
end


>
> Regards
> Michael

Reply all
Reply to author
Forward
0 new messages