Comments (10)
perhaps we could do something like this
<%= best_in_place @blah, :field, update_multiple: [[:total], [:whatever]] %>
from best_in_place.
This would be extremely helpful, +1
from best_in_place.
Can you confirm this isn't already possible by handling the ajax:success event?
from best_in_place.
where would we but the ajax:success? i mean if you have lots of fields you'll be managing a lot of it. it would be nicer to have some kind of way to do it from best_in_place
from best_in_place.
I can confirm. Here's a simple example using jquery:
$('.best_in_place').change(function() {
$.ajax({
success: function() {
}
});
});
from best_in_place.
artellectual, i had the exact same problem: price, quantity, sum displayed in a row and below the table total price of all products, user can change quantity and sum with total price should be updated.
I did it like this:
Moved my order information into a partial, created new route
get 'order_sum', :controller => 'orders', :action => :order_sum
Added this action to a controller to display partial
def order_sum
render :partial => 'shared/order_sum'
end
Then i add jquery
$('.best_in_place').change(function() {
$.ajax({
success: function() {
$('.order_product_sum').load('/order_sum');
}
});
});
But i have a problem with displaying information. Firstly, i wanted to make that only column with sums is in partial and gets updated. But i havent figured out how to display it properly. I tried to move the whole table into partial and when u use it for the first time - everything loads up perfectly, but then best_in_place stops working...
from best_in_place.
The solution to broken best_in_place after loading the whole table was pretty easy
$('.best_in_place').change(function() {
$.ajax({
success: function() {
$('.order_product_sum').load('/order_sum', function(){
$('.best_in_place').best_in_place();
});
}
});
});
from best_in_place.
its not the cleanest solution though, you have to create a custom order_sum action. when you update the object using best_in_place it returns the json data anyway it should update the field using that new data, instead of loading the data twice.
from best_in_place.
Hi everyone,
I've tried to implement this on my fork of the project, on the update_with branch : https://github.com/VonD/best_in_place
I haven't wrote tests for it yet, but it works fine on my app.
Can you please have a look at it and tell me what you think ?
Please make all comments as it is the first time i put my hands on a gem.
The docs are updated, but here is the syntax :
= best_in_place object, field, :update_with => :other_field
Or
= best_in_place object, field, :update_with => [:other_field1, :other_field2]
In case you need to update an attribute that is never editable, i've introduced a new block syntax :
- best_in_place object do |bip|
= bip.input field, :update_with => [:other_field1, :other_field2]
= bip.input other_field1
= bip.no_edit other_field2
Thanks, I'd like to have opinions before submitting a pull request
from best_in_place.
Hello everyone,
We think that the best option for now is to use AJAX callbacks in order to update what you want to be updated in the view. It might not be the best possible solution but, for now, is the most practical approach.
We do not plan to implement this whole feature, but feel free to provide a pull request with tests and the implementation of this.
from best_in_place.
Related Issues (20)
- Rails 6 deprecation warnings
- undefined method `service_path' when adding best_in
- editing an item in a jsonb column
- undefined method `service_path' when adding best_in_place
- bip_text Test Helper datapicker MiniTest failure
- How to select foreign_key using friendly_id's hash_id?
- BestInPlaceEditor is not defined HOT 1
- Still okay to use? HOT 1
- Usage in Rails 6 HOT 28
- Rails 6 Deprecation warning
- Textarea not working HOT 1
- Rails 6 deprecation warning HOT 4
- How do differ best_in_place xhr request from othes?
- Project status HOT 6
- ActionView::Template::Error (wrong number of arguments (given 1, expected 3..4)) with cancan
- update is sent even though no change is made
- Render partial not working in ajax:success
- Release a new version, please HOT 2
- ignore this
- Add Ruby 3.2 support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from best_in_place.