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

Grid *Edit* demo broken #442

Closed
davidshen84 opened this issue May 22, 2013 · 6 comments
Closed

Grid *Edit* demo broken #442

davidshen84 opened this issue May 22, 2013 · 6 comments

Comments

@davidshen84
Copy link

I am trying the Edit On Focus Cell Selection Example demo, and it does not allow me to edit. In the Plunker, the gridOptions does not have the enableCellEdit: true attribute.

Also, this demo does not teach people how to bind the view and data model. And I have not figured it out either :( Please update the demo, with data model binding example.

Thanks.

@slgoldberg
Copy link

Not only is the demo itself broken (due to renaming of the attribute as above), but the actual implementation somewhere inside ng-grid is also broken (see below).

Focussing on an editable cell and changing the contents results in this JS error:

TypeError: undefined is not a function
at http://angular-ui.github.io/ng-grid/lib/ng-grid.debug.js:3010:42
at Object.e.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:220)
at Object.e.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js:86:327)
at HTMLInputElement. (http://angular-ui.github.io/ng-grid/lib/ng-grid.debug.js:3010:24)
at HTMLInputElement.p.event.dispatch (https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js:2:37944)
at HTMLInputElement.g.handle.h (https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js:2:33881)

I talked with Misko about this, and he looked at the error above and concluded:

"$eval('row.entity.' + col.field) = 10 <-- this is meaningless"

Perhaps it's just a typo in ng-grid.js? Please investigate. Thanks.

Steve

@c0bra
Copy link
Contributor

c0bra commented May 22, 2013

This is a duplicate of #364, #399, and #440.

Yes that $eval either needs to go or get parsed out. I wrote a fix in the 2.0.6 branch that parses it out before creating the getter and setter with $parse but perhaps the $eval is useless there. I don't know the original intent for adding it.

@swalters
Copy link
Contributor

I'll take a stab at taking the $eval out. I don't know why it was added so therefore I don't know what to test when it's gone, but allowing people to do their own templates pretty much demands that COL_FIELD be the naked property.

@slgoldberg
Copy link

Awesome, thank you guys for looking at it. Since I am hoping to make progress w/o waiting for 2.0.6 or future branches to be official, is there some way I can hack around this problem myself? I.e., can you prescribe a quick fix for me? Thanks heaps.

Steve

@slgoldberg
Copy link

Shane, that change works brilliantly for my purposes, and unblocks me. Thank you! I like that it's now pretty standard (using ng-model; and adding my own ng-blur directive works great). I'll just hack this into my copy for now. :-)

c0bra added a commit that referenced this issue May 28, 2013
-Removed the $eval on COL_FIELD placeholder
-Simplified ng-input to only be concerned with hiding keystrokes and
using ESC to backout edit
-Use ng-model in EditableCellTemplate to do actual binding
c0bra pushed a commit that referenced this issue May 28, 2013
-Removed the $eval on COL_FIELD placeholder
-Simplified ng-input to only be concerned with hiding keystrokes and
using ESC to backout edit
-Use ng-model in EditableCellTemplate to do actual binding
@jonricaurte jonricaurte mentioned this issue Jun 28, 2013
@jonricaurte
Copy link
Contributor

This works in 2.0.7. (was fixed in 2.0.6)

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

5 participants