Support for field collection
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | field-collection-support-1209802-6909382_1.patch | 1.51 KB | SRizo |
| #9 | field-collection-support-1209802-6909382.patch | 1.31 KB | Nick Robillard |
| #8 | editablefields_field_collection.jpg | 89.25 KB | Nick Robillard |
Comments
Comment #1
Yuri commentedDoes indeed not work with field collections.
Please add support for this, since field collections are becoming very popular.
Comment #2
krlucas commentedChanging Category to Feature Request. And just to be clear, Yuri, you are asking for integration with http://drupal.org/project/field_collection ?
Comment #3
Yuri commentedYes, that's correct.
Comment #4
tancAdding my voice to the request. Would be great to see integration.
Comment #5
micheas commentedStrange, it seems to more or less work for me with field collections.
Comment #6
seemas commentedmicheas, what version are you using?
Thanks
Comment #7
micheas commentedseemas: dev checked out of git.
Comment #8
Nick Robillard commentedGlad to see others are interested in this too. Initially Field Collections may appear to work but headers are missing (when using Field Collection Table) and empty rows / Javascript errors occur once you click Add Another Item and then try to drag a row.
As the screenshot shows, when using the Embedded widget with Editable formatter, the header row does not have any data and when Add Another Item is triggered, blank rows are inserted and dragging produces the Javascript error: "TypeError: rowSettings is undefined" tabledrag.js line 689.
I'm about to dive into code and will post my solution. If anyone has got this working or has made any progress, please share!
UPDATE: The Javascript errors were the fault of Field Collection Table. There are still element visibility JS issues but they relatively simple. Patch coming.
Comment #9
Nick Robillard commentedWith this change, I have Field Collections working nicely. Yay! Without this, Add, Remove and Add Another Item links are hidden when they should not be.
A few notes.
Field Collections bring up some UX issues. One example - if you modify a textarea and the next action is clicking on a radio button (so the 2 change events are fired nearly simultaneously), the second action does not "get caught" and the last selection reverts to its previous state. I fixed this particular issue by adding a 100ms timeout to the save action (not included in the patch). There are other cases, such as moving from a textarea to a select. Upon clicking select, the textarea save is triggered, and the select element suddenly deselects. Minor things - but bad UX nonetheless.
Comment #10
dreamer777 commentedI try to implement editablefields for field collection and found this article
http://alexrayu.com/blog/saveupdate-field-collection-without-nodesave
Are there any ideas how to update the field collection item without re-saving the whole node?
I will appreciate your help!
Comment #11
SRizo commentedHere is a new patch for field collection. Added a new class for triggerHandler, otherwise ajax doesn't save the chaged.
Comment #12
osopolarIf there are multiple submit buttons i.e. the remove or the add another item buttons for field-collection fields where all of them have the same css class
form-submitajax subission (javascript change event) seems to trigger the remove button and/or the add another item button, so the field collection items where not saved.Using a different class for the save button as in #11 will fix the problem.