ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
itemEdited function after Grid Crud item update doesn't work
Title:
B
I
{code}
?
hi, I'm testing intensively your grid for a project of a customer of mine. I have to 2 aspnet.core mvc samples using awesome grid and both samples are duplicate code; in one, everything is working fine. In second one, after an Grid item update, I click Ok to close the popup and I can see an JavaScript error in the `utils.js` in the `itemEdited` function: the line `var altcl = $row.hasClass("awe-alt") ? "awe-alt" : "";` causes an error because the `$row` from the line before is undefined. Can you put me in right track to identity the possible cause if this behavior ? Thanks Cheers -Vince itemEdited: function (gridId) { return function (item) { var $grid = $('#' + gridId); var api = $grid.data('api'); var xhr = api.update(id(item)); $.when(xhr).done(function () { var $row = api.select(id(item))[0]; //undefined var altcl = $row.hasClass("awe-alt") ? "awe-alt" : ""; //error $row.switchClass(altcl, "awe-changing", 1).switchClass("awe-changing", altcl, 1000); $grid.data('o').lrso = 1; }); };
Save Changes
Cancel
vRITHNER
asked at 04 Aug 2017
check the `item` obj, see if it contains an Id property, on edit Post action you're supposed to return `{ Id = 123 }`
at 04 Aug 2017
Omu
Forgot to write my Id keys are Guid (work fine my 1st sample) Item value in debug mode: item {id: "e5120b67-51f0-4035-a46f-45c2d3fe3698"} but var $row = api.select(id(item))[0]; VM749:1 Uncaught ReferenceError: row$ is not defined var altcl = $row.hasClass("awe-alt") ? "awe-alt" : ""; utils.js:140 Uncaught TypeError: Cannot read property 'hasClass' of undefined at Object.<anonymous> (utils.js:140) at i (jquery-1.12.4.min.js:2) at Object.fireWith [as resolveWith] (jquery-1.12.4.min.js:2) at y (jquery-1.12.4.min.js:4) at XMLHttpRequest.c (jquery-1.12.4.min.js:4)
at 04 Aug 2017
vRITHNER
please see the solution here: http://aspnetawesome.com/forum/question/1274/options-for-setting-odropdown-value-from-url-call
at 04 Aug 2017
Omu
Thanks very much. It's working fine now. Just wonder how this is working in my first sample.
at 04 Aug 2017
vRITHNER
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK