@Bruno: i understand MIGX can reorder the rank on drag and drop but i want to be able to set each resource with its own rank TV without having to go to a seperate grid for that. I think its real elegant to have the same input type there is for menu index on each resource. so you can take a resource that has a rank of 8 and just turn the 8 to a 5 and all other resources that have a rank reorder on save.
@BobRay
Quote from: BobRay at May 29, 2015, 04:49 PMIf you change a rank8 page to rank5 by editing its TV, and there already is a rank5 page, you will have two rank5 pages. How would any code that runs later know which of the two rank5 pages should come first?
Typically, PHP would put the one with the earlier creation date first (with a lower rank using my code).
thats exactly the challenge. in your code above there are 2 ranks5. of course the resource that is being edditted has to change to rank5 the other one has to change to rank6. in your code above you'd have no control over which of the to rank5's would become rank6.
collection[0] = {id:0;rank:0}
collection[1] = {id:1;rank:1}
collection[2] = {id:2;rank:2}
collection[3] = {id:3;rank:3}
collection[4] = {id:4;rank:4}
collection[5] = {id:5;rank:5}
collection[6] = {id:6;rank:6}
collection[7] = {id:7;rank:7}
collection[8] = {id:8;rank:8}
collection[9] = {id:9;rank:9}
Now move nr 8 to 5th place
collection[0] = {id:0;rank:0}
collection[1] = {id:1;rank:1}
collection[2] = {id:2;rank:2}
collection[3] = {id:3;rank:3}
collection[4] = {id:4;rank:4}
collection[8] = {id:8;rank:8}
collection[5] = {id:5;rank:5}
collection[6] = {id:6;rank:6}
collection[7] = {id:7;rank:7}
collection[9] = {id:9;rank:9}
and reindex
collection[0] = {id:0;rank:0}
collection[1] = {id:1;rank:1}
collection[2] = {id:2;rank:2}
collection[3] = {id:3;rank:3}
collection[4] = {id:4;rank:4}
collection[5] = {id:8;rank:5}
collection[6] = {id:5;rank:6}
collection[7] = {id:6;rank:7}
collection[8] = {id:7;rank:8}
collection[9] = {id:9;rank:9}
I just have'nt a clue how to do this with a plugin. Actually my first thought was doing this with an custom TV input type. but that's way over my head.