-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Major bug in editable ng-grid cells. #399
Comments
This is an issue with how src/ng-input.js is handling the value of the ng-input directive. The current default template contains an $eval, which means that when ng-input.js runs a $parse on it, it gets the evaluated value of the cell itself. For a string, (which is an object) this ends up not actually modifying the cell contents but at least it doesn't fire an exception. For an integer primitive you would end up with an undefined setter and a noop getter, which would throw exceptions when you try to use The fix, as I see it, is to use a regex to strip out the $eval statement from the ng-input in the editable cell template. |
This is an issue with how src/ng-input.js is handling the value of the ng-input directive. The current default template contains an $eval, which means that when ng-input.js runs a $parse on it, it gets the evaluated value of the cell itself. For a string, (which is an object) this ends up not actually modifying the cell contents but at least it doesn't fire an exception. For an integer primitive you would end up with an undefined setter and a noop getter, which would throw exceptions when you try to use undefined as a function to set the cell value. The fix, as I see it, is to use a regex to strip out the $eval statement from the ng-input in the editable cell template. I've also cleaned up ng-input.js, added some comments, and added handling for when the enter key is used to modify a cell's contents
Closed in 2.0.6 branch |
I have a doubt if we really need to fix this here since I believe the regression happened when fixing issue #337 where $eval was added around the COL_FIELD which is perhaps not needed. Idea is to fix the root cause instead of fixing a symptom. We could revert back to: html = html.replace(EDITABLE_CELL_TEMPLATE, $scope.col.editableCellTemplate.replace(COL_FIELD, "col.field")); |
If I set an editable cell's data to a number, a string CONTAINING a number, undefined, a regex, or an object I get an exception.
Reproduced here. http://plnkr.co/edit/PAHeSd?p=preview
Try editing a value in the age column.
The text was updated successfully, but these errors were encountered: