I created a very simple DV with the option of saving the weight using full arguments to avoid sorts interfering with each other. However, after saving the view for a couple of different arguments and veiwing the results it was clear the argument was not being used to differentitate which nodes to view in a sort. There were apparent duplicates.
I tracked the problem down to the fact that the options item 'draggableviews_setting_view' was empty rather than holding the default value 'self' as the code suggested. This meant that the join handler didn't add any of the join conditions to identify this particular sort in the draggableviews_structure.
The problem seems to be caused in the draggableviews_handler_sort.inc code where the default 'self' should be set. However in this simple case of only one view with a sort the default 'self' is stored in $options but then the form element value is set to $this->options['draggableviews_setting_view'], the previous value of this option which was empty. So the default value is never set.
The code:
$form['draggableviews_setting_view'] = array(
'#type' => 'value',
'#value' => $this->options['draggableviews_setting_view'],
);should be changed to:
isset($this->options['draggableviews_setting_view']) ? $options = $this->options['draggableviews_setting_view']: $options = 'self';
$form['draggableviews_setting_view'] = array(
'#type' => 'value',
'#value' => $options,
);
or something similar so if the previous value is empty the default is used.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | draggableviews-1529432-5.patch | 622 bytes | nonzero |
| #2 | draggableviews-1529432-2-bogus-reorder-with-arguments.patch | 542 bytes | robertom |
Comments
Comment #1
jkempff commentedTHANK YOU!
Works like a charm for me!
Comment #2
robertom commentedI have same problem and the patch fix it also for me.
After apply the patch is needed to resave (apply on views UI) "draggableviews sort criteria" on views with draggableviews field
Comment #3
robertom commentedComment #4
nonzero commentedThe patch at comment #2 doesn't seem to include the first edit to the file by dippers:
Comment #5
nonzero commentedAdded the line above with a slight modification.
Comment #6
robertom commentedOps... I first fixed this bug for my own use, and after I have found this issue, so... I haven't saw this snippet of code.
When is needed this snippet of code?
On comment say:
and $option is initialized with 'self' and never changed for setting view...
Comment #7
bryancasler commented#5 worked perfectly for me
Comment #8
ygerasimov commentedCommitted. Thanks!
Comment #10
off commentedThank you!