i'm using gem called "rails3-jquery-autocomplete" ( https://github.com/crowdint/rails3-jquery-autocomplete )
it's working fine:) there's 1 thing want disable.
when type input field, , there's no matching record, show message that's saying "no existing match"
i want disable message. possible?
wish see inside of source code customize cannot :(
anyone can me this? might piece of cake not me.
for information, i've done command below
$ bundle exec rake assets:precompile rails_env=production
and after created js files public/assets
folder
seems there no way pass option control, assume might trick solve problem.
instead of returning empty array(from backend) when no search results, try return array 1 result has empty id , label might solve problem, in rails controller, there this:
def autocomplete_action result = do_the_search if result.count == 0 result = [{ id: "", label: "" }] # !! trick here end respond_with result # assume have "respond_to :json" in controller end
here why doing this:
the reason why think might work because if no result return, autocomplete control build fake record id equals empty represent no result.
if(arguments[0].length == 0) { arguments[0] = [] arguments[0][0] = { id: "", label: "no existing match" } // hacked here }
but think not right way solve problem, it's workaround solve problem quickly.
hope helps, thanks.
Comments
Post a Comment