Problem/Motivation

I need to reorder submitted data of the webform module.

It's useful when generating final list, using a field weight to order submissions.

I think it's a good feature because Views is the most important Drupal module, but Webform is the second.

Proposed resolution

Since the need for this is small, Create a submodule just like draggableviews_book.

Remaining tasks

Create view field code (Chi patch is a good start)
Determine if we want to use native handler or add a column to the submission table

User interface changes

There will be an addition field added to the view.
What the extra field for webform submission will look like

Original report by djpable, MrPaulDriver

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

djpable’s picture

Issue summary: View changes
joshuautley’s picture

I found this issue because I too was looking to add a weight field for use with https://www.drupal.org/node/283498
(draggable views). We have many form submissions which we'd like to be able to manually drag and drop into the order needed.

Draggable views gives us the option to change the handler via FieldAPI but there are no fields that contain weight.

The Number field may work. I'll have to test. Nope that didn't work. )=

Anyone ever used draggable views with webform submissions?

iStryker’s picture

So the ideal way would be to have the webform submission page be able to be reordered. If you did not have "Access Draggableviews" permission then you could still view the webofrm submission page, but not be able reorder.

I see no easy way to do this. I envision adding a weight field to the webform_submission table and a custom handler.

This custom handler might be able to be reused. Have it use any 'weight' column in the associated database table.

Chi’s picture

iStryker’s picture

Thanks for the related link @Chi. I believe most of the progress will be made in #2143029, Unless, we add a custom handler like I stated in the last sentence in #3. The more I think about this, the more I see this as being practical for modules the have plain table with a weight value.

iStryker’s picture

Title: Support for views on webform submitted data: sid, weight (custom field) » Create submodule to support webform submitted data views page
Issue summary: View changes
FileSize
976 bytes

The issue in webform #2143029: Compatibility with draggable views is now closed. All future development will take place in this issue.

The chosen method for supporting this, is in a submodule.
Reasons:

  1. webform does not want to support the code.
  2. small need. If you do not need then you do not have to enable module. Therefore no extra overhead.
  3. if we ever do add support of adding weight column to any table, then we control the upgrade path.

Chi added a patch for webform today in #2143029-10. Attached is his patch.

I have not reviewed Chi patch, not thought this through completely.

  • Do we alter the value of the sid?
  • Do we use the native handler part of draggableviews?
  • Do we add a weight column to webform_submission table then use that?
DanChadwick’s picture

I can say that you do not alter the sid (submission id). You could alter the serial number, but only if you know you are within the submission for one node (same nid) and you don't create a serial number that is larger than what you already have in the table for that nid.

Chi’s picture

Title: Create submodule to support webform submitted data views page » Support webform submitted data views page
Status: Active » Needs review
FileSize
872 bytes

The patch adds just a few lines code. Do we really need a submodule for this? Notice that it uses the native draggable views sort handler. There is no need to add some extra weight field to webform module.

Chi’s picture

Here is another patch. It is also quite simple but needs to be tested more carefully because it is more generic . The patch changes the way how draggableviews finds base tables. It makes draggable any base tables not only webform_submissions. I have tested it with Views Watchdog module and it works for me.

iStryker’s picture

Alright, this kinda blows my mind what you have done. If you can do this with any base table then we do not need a submodule.

I have tested your patch and I cannot get it working with Webform submission. I cannot get it to save to the draggableiviews_structure table. I cannot get it to sort with the draggableviews:weight sort. There is 2 fields now. Draggableviews:Content, Draggableviews:[name_of_base_table]....which one/both do I use.

kevster’s picture

I know its been a while on this one but Im trying to get this working with no joy - Ive tried several combinations but when I save it doesnt save the order (or the row weight) - @iStryker did you get this working in the end?

kadsy’s picture

i can confirm the patch from #6 no longer working or it was just me. hope someone can spark some light here.