Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[moveColumn] Sorting by clicking column header broken - triggering move instead #3333

Closed
brockj opened this issue Apr 21, 2015 · 9 comments
Closed
Assignees
Milestone

Comments

@brockj
Copy link

brockj commented Apr 21, 2015

I think this was introduced in the last few days, but clicking on the header to sort a column no longer works
you can see this in http://ui-grid.info/docs/#/tutorial/102_sorting
Clicking on the name/gender columns has no effect, but using the menu works

I will try to isolate the change that caused this. I am currently on 7df7234

@brockj
Copy link
Author

brockj commented Apr 21, 2015

This is super strange. It only appears on Chrome and restarting the browser a few times made the issue go away. Chrome version is 42.0311.90.m

please close if you can't reproduce

@PaulL1
Copy link
Contributor

PaulL1 commented Apr 21, 2015

It's working for me, but I'll leave it open and see if anyone else has issues.

@PaulL1 PaulL1 added this to the Future milestone Apr 21, 2015
@StanislavPrusac
Copy link

Sorting by click with mouse at header still is not working.
I tested at link : http://ui-grid.info/docs/#/tutorial/102_sorting and in my application
Sometime when start fresh Google Chrome, working but after refresh this same page stopped.
Working normal in Firefox 37.0.2
Google Chrome: Version 42.0.2311.135 m (64-bit)
Windows 7
Angular-ui-grid,version: 3.0.0-rc.21

@sandeeppbajaj
Copy link

Yes...its acting weird. It needs to be clicked 2-4 times and it goes through stages asc, desc and no-sorting.

@enigmak
Copy link

enigmak commented May 9, 2015

It looks like chrome calls the move function when the mouse has not moved much and the other browsers do not.

Changing the downFn to track the event.pageX and then checking it in the moveFn will correct this.

So in the downFn add the $scope.previousMouseX = event.pageX;

              $scope.mousedownStartTime = (new Date()).getTime();
              $scope.mousedownTimeout = $timeout(function() { }, mousedownTimeout);
              $scope.previousMouseX = event.pageX;

Then in the move function check for movement.

            $scope.moveFn = function( event ){
              var xMove = $scope.previousMouseX - event.pageX;

              // If we haven't moved let mouse up call fire.
              if (xMove !== 0) {
                // we're a move, so do nothing and leave for column move (if enabled) to take over
                $timeout.cancel($scope.mousedownTimeout);
                $scope.offAllEvents();
                $scope.onDownEvents(event.type);
              }
            };

@PaulL1 PaulL1 modified the milestones: 3.0, Future May 15, 2015
@PaulL1 PaulL1 self-assigned this May 15, 2015
@PaulL1
Copy link
Contributor

PaulL1 commented May 15, 2015

OK, I did the work on the downFn and move stuff, so I guess I get to fix this.

@Zorkling
Copy link

@enigmak You can also acomplish this by just varing up a previousMoveX and setting it during the down event handling. Since the drag activation only needs to happen once, and the previous move can be reset on any down event, theres no need for timers. Misread your comment, thats more or less exactly what i have in the PR, only that there needs to be handling in column-move.js as well as ui-grid-header-cell.js

@PaulL1 Would you like me to make a PR for this? I had messed with it previously but hadnt gotten around to commiting the fix

@PaulL1
Copy link
Contributor

PaulL1 commented May 25, 2015

@Zorkling : that would be useful.

@Zorkling
Copy link

@PaulL1 Pull request ready, my bad for the double commit, got too hasty with the push

In case anyone is curious, the issue has existed for almost a couple of years, heres a chromium issue that describes alot of the behavior around it
https://code.google.com/p/chromium/issues/detail?id=327114

@PaulL1 PaulL1 changed the title Sorting by clicking column header broken Sorting by clicking column header broken - triggering move instead May 27, 2015
@swalters swalters assigned AgDude and unassigned PaulL1 Jun 11, 2015
@AgDude AgDude changed the title Sorting by clicking column header broken - triggering move instead [moveColumn] Sorting by clicking column header broken - triggering move instead Jun 12, 2015
AgDude added a commit to AgDude/ui-grid that referenced this issue Jun 12, 2015
This is primarily to deal with a bug in chrome where move events are
sometimes triggered even when the cursor does not move.

Fix angular-ui#3333
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants