Jump to content

Drag drop page sorting become brittle / broken


alan
 Share

Recommended Posts

Hi fellow PWers,

Too long since I did some PW work... Setting up a new site I just went to drag-drop some pages about and I found that

1. I was not able to make a page a child of another parent (maybe finger trouble)

2. more importantly, the ability to click on a page and select it (reflected by the change in colour) dies after a failed drag/drop and will not work again; until I refresh.

It sort of feels something like the Admin uses latest jQuery from a CDN (content delivery network) rather than a named version and the latest version has a bug or is showing up a bug that an earlier version masked.

Anyone have any pointers or seen this and knows more? Thanks in advance for any comments, cheers, -Alan

Of course, now I've posted I am appearing to get good results. I wonder if it was because I was assuming I can drag anything anywhere (in the default vanilla site)? I'm now wondering if I was hitting a template-based restriction..?

Edited by alan
Link to comment
Share on other sites

That second one was reported by a fellow worker yesterday as well. I'm able to reproduce it simply by dragging a page and dropping it back to its original place. Javascript error is: "Uncaught TypeError: Cannot read property 'error' of null" at ProcessPageList.js:655. At stopMove() ajax post callback gets a null for the data parameter. Error can be fixed simply by replacing "if(data.error)" with "if(data && data.error)". Not sure what has changed though (if anything) and where so that isn't necessarily the right fix either.

The first one then. The destination parent page has to be selected first (before clicking 'move') for you to be able to move a page there. That new parent page should be highlighted as well. Could that have been the cause for the first problem? Still, it seems to be a bit challenging to find the right place where to drop the page so that it would become a child for that new parent. I guess my fingers aren't working well enough either :).

I wonder if there was something to be done for this to be easier? (I have a feeling this has been discussed earlier, anyone?)

  • Like 1
Link to comment
Share on other sites

Thanks @nik for convincing me I wasn't only seeing my own finger trouble, I am sure I was partly doing the wrong thing but I did repeatedly end up with a page that previously would highlight if clicked and now would refuse to highlight (unless I refreshed the page).

If I get clearer on precisely what I am doing wrong or what I am seeing that is wrong I'll post back here.

Link to comment
Share on other sites

Javascript error is: "Uncaught TypeError: Cannot read property 'error' of null" at ProcessPageList.js:655. At stopMove() ajax post callback gets a null for the data parameter. Error can be fixed simply by replacing "if(data.error)" with "if(data && data.error)". Not sure what has changed though (if anything) and where so that isn't necessarily the right fix either.

Thanks for finding this, I have updated the code. Most likely it's been there since the beginning, as there haven't been any recent changes to the code in question.

Still, it seems to be a bit challenging to find the right place where to drop the page so that it would become a child for that new parent. I guess my fingers aren't working well enough either :). I wonder if there was something to be done for this to be easier? (I have a feeling this has been discussed earlier, anyone?)

It can be challenging dragging a page to be the first child of another, and might take a couple tries. Keep at it and you'll get there. :) Admittedly I struggled with getting all the movements right on this action in particular, and found we might be pushing the limits of what jQuery UI draggable/droppable was wanting to do. I'm not sure how to improve that particular action, and it might take someone looking at it that is better with Javascript than me. One alternative is to edit the page you want to move and change the parent from its settings tab.

  • Like 1
Link to comment
Share on other sites

Thanks @Ryan for the super-fast fix, I looked at git but couldn't recognize it, is it one of the 8th Sept commits (not that I need it 'now' just trying to improve my git familiarity)?

It can be challenging dragging a page to be the first child of another, and might take a couple tries. Keep at it and you'll get there.

While the action for making first child is less easy than the others, I still love this approach; so intuitive and clear for users. And it's good to be reminded pages parents can be changed in the Settings tab :)

Link to comment
Share on other sites

Thanks @Ryan for the super-fast fix, I looked at git but couldn't recognize it, is it one of the 8th Sept commits (not that I need it 'now' just trying to improve my git familiarity)?

It's not in the live source yet. I like to test things out locally for a day or two before I commit them to GitHub, just to play it safe. So I'll usually push several updates at a time.

Link to comment
Share on other sites

It's not in the live source yet. I like to test things out locally for a day or two before I commit them to GitHub, just to play it safe. So I'll usually push several updates at a time.

Understood; thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...