Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Values disappearing #1

Open
alliedarmour opened this issue Nov 20, 2019 · 1 comment
Open

Values disappearing #1

alliedarmour opened this issue Nov 20, 2019 · 1 comment

Comments

@alliedarmour
Copy link

alliedarmour commented Nov 20, 2019

Hey,

first of all: thanks for this plugin, it saved me a lot of work and works perfectly with my Rails application!

I got a small problem, but I'm not sure if it's a problem with inplace or with my data. If I click on a field in my table to edit, it works fine. But if I open it to edit but don't actually edit anything (or just press cancel), the old value is gone and the table field is empty.
To display the value again, I have to reload the page.

Here's my JS-Code:

$(".inplace1").inplace({ method: 'PATCH', url: '/prices/2/1', fieldName: 'price[meal]', fieldClass: 'form-control', buttonOrder: ['save'], save: true, cancel: false, saveClass: 'btn btn-success mt-2', saveValue: 'Speichern' });

And my view code:

<div class="inplace1"><%= number_to_currency(price_clinic.meal, unit: "€", separator: ",", format: "%n%u") %></div>

I'll add a screenshot so it's clear what I mean:

inplace

Any ideas on that?

@paceline
Copy link

Not sure if you still care but you need to set data-field-value explicitly like so:

<div class="inplace1" data-field-value="<%= number_to_currency(price_clinic.meal, unit: '€', separator: ',', format: '%n%u') %>">
  <%= number_to_currency(price_clinic.meal, unit: "€", separator: ",", format: "%n%u") %>
</div>

Not particularly pretty but does the job :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants