Hello,

I have created two views - an "administration" view where administrators can drag content into order, and a separate view which uses a Draggable Views sort linked to the administration view to order its content.

The problem I'm seeing is that, when I have Views filter arguments in the URL in the administration view, when I re-order the View's content, those arguments are being saved in {draggableviews_structure} in the "args" field, for example:

{"category":"6","created":{"value":"","min":"","max":""},"created_op":"<=","status":"All","title":"","type":"news"}

I don't think these arguments should be being saved with the Draggable Views data.

In the Views query for my content view (the other view which should be ordered by the administration view), it is trying to perform a left join on the {draggableviews_structure} schema, and includes the following condition:

LEFT JOIN {draggableviews_structure} ... AND draggableviews_structure.args = '[]'

Because the .args field isn't '[]' but contains the serialised arguments, this join never works and I always get a weight of 0.

I think this is a bug, and quite a serious one, but hopefully it's just come about because I have misconfigured something?

Thanks very much in advance,

Alex

Comments

alexharries created an issue. See original summary.

istryker’s picture

Category: Bug report » Support request
Status: Active » Closed (won't fix)

Some people want them, other people do not. See the draggableivews.api.php file which contains a hook you can use. If you can think of a better solution, then I am open to it.

alexgreyhead’s picture

StatusFileSize
new202.92 KB

Hmm, the simplest suggestion I can offer would be to give the option to simply not include a query->where on the args column at all, perhaps? :)

E.g.:

Monkeys

istryker’s picture

Category: Support request » Feature request
Status: Closed (won't fix) » Active

So you are asking for a Where clause in the database and an ignore option for the sort view, sort filter.

alexgreyhead’s picture

Nearly, yes; I think what would be ideal here would be to allow the filter to not add any condition('args', array $something) at all so the contents of the args column would be completely ignored.

alexgreyhead’s picture

Patch attached (but written against 7.x-2.1 I'm afraid) - if you think this might be worth pursuing, I can re-write it against the 7.x-dev version?

alexgreyhead’s picture

StatusFileSize
new190.86 KB
new305.22 KB

A couple of screenshots of the change in action:

)

)

alexgreyhead’s picture

Status: Active » Needs review
istryker’s picture

Actually if I remember correctly if you use "Do not use arguments" on the order view and "Do no use arguments" on the display then it will achieve the results you desire. If it does not, then I believe something broke. I am tempted to change the wording, maybe even have different wording for the order sort and display sort.

alexgreyhead’s picture

Hi iStryker,

I could be wrong, but when I grokked the code, I'm pretty certain there's no option to simply skip adding a "where" clause based on the args column at all; that's what my patch changes.

:)

/Alex

Status: Needs review » Needs work

The last submitted patch, 6: draggableviews-2916004-allow-ignoring-of-args.patch, failed testing. View results

jmuzz’s picture

I agree with @alexharries. I tried using "Do not use arguments" in the order view but then the order view no longer shows the order it saved next time you view it. The order tables always save the arguments and "Do not use arguments" does not stop them from being saved, it only stops the table from reading the arguments that it saved, and there's still no way to use the data from the ordering table while ignoring the arguments unless the patch is applied.

jmuzz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.51 KB

I am also using 2.1 and haven't modified the code, I just re-rolled this using the correct p level for the patch.

alexgreyhead’s picture

Thank you jmuzz - much appreciated :)