best_in_place
best_in_place copied to clipboard
display_with: :number_to_currency not showing currency after update
Awesome gem!
When using display_with: :number_to_currency
, the currency symbol disappears after updating the field. Everything else is working fine.
This is because of turbolink (aka turbo-break-everything-ever). You need to trap the ajax:success event on the field you want to display correctly.
You also have to make sure you're looking for "ready" not just "page:load" events. Here's a working example I use:
$(window).on 'ready page:load', ->
$('.default_cost').bind 'ajax:success', ->
cost_field = $(this).find('span').first()
cost = Number(cost_field.text()).toFixed(2)
cost_field.text("$" + cost)
return
I have tried with your example, but its not working.
@vuppalasrinivas The solution is to use "respond_with_bip". I had the same problem but using that in my controller action fixes it. See here: https://github.com/bernat/best_in_place#controller-response-with-respond_with_bip
@seuros display_with (;
Yea... respond_with_bip works very nice.