ajax-datatables-rails icon indicating copy to clipboard operation
ajax-datatables-rails copied to clipboard

Integer only support

Open ohaddahan opened this issue 6 years ago • 2 comments

https://github.com/jbox-web/ajax-datatables-rails/blob/66e81baa3ca373248e706cc964f9adcc748e938d/lib/ajax-datatables-rails/datatable/column/search.rb#L63

Why such a harsh limitation? What about Float comparison?

ohaddahan avatar Sep 13 '18 09:09 ohaddahan

I monkey patched it locally and it works great. BTW, there are 3 casting, performance wise, save the first casting results and check against it.

def is_out_of_range?(search_value)
 Float(search_value) > LARGEST_PQ_INTEGER || Float(search_value) < SMALLEST_PQ_INTEGER
end

def is_integer?(string)
 true if Float(string) rescue false
end

ohaddahan avatar Sep 13 '18 14:09 ohaddahan

Why such a harsh limitation? What about Float comparison?

https://github.com/jbox-web/ajax-datatables-rails/commit/192f5d3030e3dd021a4f5e3a5b124b516207f493 https://github.com/jbox-web/ajax-datatables-rails/pull/284

You're right.

n-rodriguez avatar Oct 16 '18 18:10 n-rodriguez