D7: When using editablefields ( http://drupal.org/project/editablefields ) the current table highlighter D7 dev version shows only the right color when the page is refreshed. But, the idea behind the editablefields is that no page refresh is needed.
Might be a bit early to come with such a use case for a not yet released D7 dev version of table highlighter, but people working with tables will use the editablefields module very soon...page refreshes are used less and less in web tables these days.
| Comment | File | Size | Author |
|---|
Comments
Comment #1
smokrisChanging this to an editablefields feature request: editablefields would need to refresh the view after the field is saved.
Comment #2
ironbuilt commentedCan I add a bounty for this? $100?
When using editable fields in a View editable fields needs to update the entire single row in the view upon save. Anyone interested?
Comment #3
johnvThere has been some developments.
Is this still a problem with latest -dev from february with the following patches?
#1206656: Error on Node view page: Argument 1 passed to drupal_array_get_nested_value()
#1405854: Multiple fields not saved
Comment #4
zdean commentedAlthough the "save" feature is working, the "refresh" page feature provides slightly different functionality. For my case, I have a view that is grouped by one of the fields. When an editable field is edited, it affects which group the row belongs to. So, on changing the editable field, I have to refresh the page in order for the new grouping to be displayed. Is this something that could be done automatically so that on edit of the field the page refreshes to show the new grouping of rows?
Thanks!
Comment #5
JorgenSandstrom commentedComment #6
bradjones1The use case in the ticket summary mentions another module, table highlighter, though I think the real request here is for the view to refresh, and if it's got additional functionality provided by another module, so be it.
Views does have the option to refresh its results with Ajax after an exposed field is selected submitted. I think the best course of action here would be to replicate/borrow from that event in views during the editablefields Ajax response. Or, do I have the requirements wrong? Seems pretty straightforward.
Comment #7
charlie-s commentedI've been tinkering with this a bit today.
In views/includes/ajax.inc we have the views_ajax() function, which, given a view name and display ID will return the markup for a view. You can even throw something like this together and return the view's markup yourself:
and then get it via $.ajax really easily:
but I can't get this to only fire for my editablefields' ajaxComplete() function. I'm getting my hands dirty to make this happen but would really appreciate any direction anyone can share!
Comment #8
miccelito commentedRefreshing a views page (that may have 100+ rows) with editable fields in scope that you want i.e. to highlight various background colors for certain field depending on earlier choice of a field's select option, is maybe not good idea since it would be annoying if you edit a select field i.e. at row #50 and if page is refreshed you get back to row #1...
Maybe the solution should be another without having to refresh page. I would like to have an editable field with list select with options - i.e. to make an schoolar example - red, green and blue. Choosing 'blue', module Editablefields would add class 'blue' to the select tag's classes. And with that we could use css to background-color field or even row.
Modules related...
http://drupal.org/project/views_table_highlighter
http://drupal.org/project/field_formatter_class
http://drupal.org/project/select_with_style - adds classes to select options tags and even selected option tag with no need of refreshing page, select field needs to be added via taxonomy with terms as options (content type level) and in that way select options (terms) will have classes when adding the field in Views
Comment #9
WorldFallz commentedI just stumbled across this need myself recently-- has anyone figured out how to get an editablfield to refresh a view?
Comment #10
WorldFallz commentedI finally managed to work it out myself: http://drupal.org/node/1988484 (for d6 however).
Comment #11
vaccinemedia commentedHas anybody figured this out for Drupal 7?
Comment #12
Yuri commentedSeems like a very common need..
Comment #13
RaceCorp commentedHere is a hack to update a view based on an editable field ajaxcall being completed. It's a complete hack and there is probably a much easier way, but this may inspire someone to do it the right way.
Some PHP to refresh the order (If you need).
JS: mymodule.js
Comment #14
train commentedIf I may add to the conversation...
Based upon the code above, this is what I use to update any AJAX enabled View when an editable field is changed:
Comment #15
johnkareoke commented@TrainQuick question: Is this an ajax view that contains an editable field that is being updated, or are all ajax views on a page being updated? My use case is as follows: I have a panel that has a ajax enabled view in a pane (without any editable fields), and an editable field in another pane. The above code doesn't seem to work. Is it naive of me to think it would?Comment #16
johnkareoke commentedComment #17
johnkareoke commentedI've been having some trouble with this. I'm able to refresh my view, so I know that part is working, but I seem unable to limit it to editable field ajaxcall completing.
I'm using the following code:
I've tried to isolate the ajax call unsuccessfully as follows:
Any suggestions would be appreciated.
Comment #18
hondaman900 commented@Train #14
I also need this functionality. My editable field saves the change to the database field but calculations in views using that field do not update with the new value without a page refresh. I'm hoping your code will automate that by forcing a page refresh on clicking SAVE for edited fields.
My question is, where does your code in #16 go? How do I implement it. I'm finding my way around programming Drupal, so forgive me if this seems obvious to you.
Thanks in advance
Comment #19
delacosta456 commentedPleas has any one one found a workarround
thanks
Comment #20
hondaman900 commentedYes, I found a kludgie workaround. I added a button to the View footer, in a Global Text Area field, for the user to "accept changes". The button refreshes the page which commits the changes. Here's the code:
It's not pretty, but it works for me. Hope this helps.
PS: I should add that this only works if the user allows the ""Please wait'''" ajax updater to complete after the field loses focus. In a case where the user makes the edit and then clicks on the "Accept Changes" button next (the intuitive thing for the user to do) then it's a crap shoot as to whether the ajax update to the database has completed before the page reloads.
Comment #21
shevgenyhow can you not update the whole View, but only the edited Row?
Comment #22
pinueve commentedComment on #20, I followed your suggestion, but i placed an A anchor to muy button like:
<a href="/same/path/page" class="btn btn-success">Refresh page</a>