Skip to content

Column menu repositioning throws exception when second column menu button is clicked #1734

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

Closed
c0bra opened this issue Oct 6, 2014 · 0 comments
Assignees
Milestone

Comments

@c0bra
Copy link
Contributor

c0bra commented Oct 6, 2014

To reproduce:

  1. Go to the sorting tutorial (http://ui-grid.info/docs/#/tutorial/102_sorting)
  2. Click on the left-most column's menu button, the menu will show.
  3. Click on any other column's menu button.

You will get an exception in your console like so:

TypeError: Cannot read property 'lastMenuWidth' of undefined
    at Object.service.repositionMenu (http://ui-grid.info/release/ui-grid-unstable.js:430:31)
    at Scope.$scope.showMenu (http://ui-grid.info/release/ui-grid-unstable.js:517:35)
    at Scope.$scope.toggleMenu (http://ui-grid.info/release/ui-grid-unstable.js:896:46)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:10567:21
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:18627:17
    at Scope.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:12412:28)
    at Scope.$apply (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:12510:23)
    at HTMLDivElement.<anonymous> (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:18626:21)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:2780:10
    at forEach (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js:330:20) 

It is probably happening because since the column's menu has not been shown yet, it has no lastMenuWidth property defined. There probably needs to be a typeof($scope.col.lastMenuWidth) === 'undefined' || $scope.col.lastMenuWidth === null check, or something like that.

@c0bra c0bra added this to the 3.0 milestone Oct 6, 2014
@c0bra c0bra changed the title Column menu repositioning throws exception when unsortable column menu button is clicked Column menu repositioning throws exception when second column menu button is clicked Oct 6, 2014
@PaulL1 PaulL1 closed this as completed in e8d63cd Oct 6, 2014
PaulL1 added a commit that referenced this issue Oct 6, 2014
Fix #1734(menu): type error on reposition
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

2 participants