How can I set up a default sort order (eg date posted) but override the order for certain nodes?

I have a list of articles sorted in order of the date they were posted. I want to be able to move any node up or down, but I want nodes that i haven't moved to stay in the date order.

Thanks

CommentFileSizeAuthor
#7 Bildschirmfoto 2010-09-09 um 23.41.37.png16.66 KBsevi

Comments

jdln’s picture

I figured I could do this with the table's 'Default sort' option but I get this message 'The structure was broken. It has been repaired.'
Thanks

sevi’s picture

No, the "Default sort" is actually not supported by DraggableViews. It already disappeared in the current dev-version.

What you want to accomplish is pretty tricky.
1) If new nodes are added rarely to your draggable view you can sort your view once by date (using click sorting) and change certain nodes afterwards.
2) Otherwise, if you add nodes frequently, you make the same as in (1) but additionally change the order-number of new nodes according to its date manually (programmatically).

jdln’s picture

What im trying to make is a forum style thread for collaborating. Content will be added often so no 1 isnt suitable.

For no 2, what do you mean 'programmatically'?

Thanks

jdln’s picture

Just a thought, as draggable views uses a field for the order that views recognizes, could the rules module (or similar) assign a value to this field when a node is created?

Or could it even assign a value of 1000 (more nodes and a view will ever hold) and then would the 'The structure was broken. It has been repaired.' fix it, so if their were 12 nodes it would make the new one number 13?

Thanks

jdln’s picture

Ive had another thought as a feature request but i dont know how hard this would be to do.

What if the field draggable views used for the order didnt have to increase a single whole number at a time? So instead or requiring 1, 2, 3, it could work like normal views sorting so 1, 20, 36 would be ok.

Then when a node was created you could use rules to make the node's order field the created date value. Then when draggable views override this value for a node it would still work.

So if the original order values were;
node1 - 111
node2 - 222
node3 - 333
node4 - 444

Then when you wanted to move node1 to come after node2, draggable views would change its value to anything in between 222 and 333.

node2 - 222
node1 - (any value from 223 to 332)
node3 - 333
node4 - 444

If this worked it would allow draggable views to override individual nodes for any other sorting method.

sevi’s picture

I need this strict ordering because of the repair algorithm.

Imagine: What if, because of whatever reason, the structure is broken and looks like this:
node1 - 1
node2 - 2
node3 - 2
node4 - 2
node5 - 3
Well, a human would say:
*) Throw a dice to decide that node2 comes before node4 before node3.
*) Then simply change the order-values accordingly:
node1 - 1
node2 - 2
node4 - 3
node3 - 4
node5 - 3
Ups, now the order-value of node5 has to have a higher number than 4. Let's set it to 934 to sure it comes last.

Situations like this can be much more complicated, especially when there are hierarchies involved which child nodes of child nodes have to be reordered too.

This is the reason why I use this strict ordering.

sevi’s picture

StatusFileSize
new16.66 KB

Or could it even assign a value of 1000 (more nodes and a view will ever hold) and then would the 'The structure was broken. It has been repaired.' fix it, so if their were 12 nodes it would make the new one number 13?

Yes, this is what the "On Bottom" radio button at the style plugin settings should do (see screenshot). I hope it works :)

sevi’s picture

For no 2, what do you mean 'programmatically'?

What I wanted to say is that this cannot be done with a few clicks in an UI. You have to write custom code for your special situation.

jdln’s picture

Category: support » bug

Thanks a lot for your reply.
I should be able to achieve what i need with the 'behavior of new nodes' option. However I think ive found a bug.

Ive set new nodes to be 'on top'. If I create a new node and then refresh the views page, I get the 'The structure was broken. It has been repaired.' message and everything works fine.

node3
node2
node1

However, if I add 2 new nodes and then refresh the page, they are added in the wrong order;

node4
node5
node3
node2
node1

Thanks

sevi’s picture

Category: bug » support

You mean the
node4
node5
..
instead of
node5
node4
..
?
This is completely random. DraggableViews has no chance to know which node was created first. When you refresh the views page all nodes that don't have an order-number are treated the same.

This isn't a bug.

jdln’s picture

OK. Other than redirecting to the draggable views page, is their way of making the view refresh after creating a piece of content?
Thanks

web2get’s picture

Category: support » bug

#7 is really helpful for me.

Thanks sevi.

istryker’s picture

Category: Bug report » Support request
Issue summary: View changes

6.x in now unsupport. Closing this issue.

istryker’s picture

Status: Active » Closed (won't fix)