ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Ajax List Crud with Guid Custom Items
Title:
B
I
{code}
?
My ajax list isn't updating after creating a new item ... first guess is that my custom list item isn't correct because of Guids. Will this work where Ids are GUIDs? <li class="awe-li" id="Face@(o.Id)" data-val="@(o.Id)"> Not quite sure how jQ is wired to handle json string of RenderPartialView, so having a hard time troubleshooting it.
Save Changes
Cancel
Stephan Luis
asked at 21 Sep 2017
are you getting any errors ? server or client side in the browser console ?
at 22 Sep 2017
Omu
Not getting any errors.
at 22 Sep 2017
Stephan Luis
in the demo we're using a custom helper `InitCrudPopupsForAjaxList` if you look inside you'll see 3 `InitPopupForm` helpers, one for the edit and it has `.Success("utils.itemEditedAl`, so you can open utils.js and put a `debugger;` inside `itemEditedAl` and after you can debug the function using chrome
at 22 Sep 2017
Omu
Cracked it! The example code CrudHelpers.cs codes a 'Create' with .Success("utils.itemCreatedAlTbl('" + ajaxListId + "')"), as you see above I'm using a list <li> so had to update to .Success("utils.itemCreatedAl('" + ajaxListId + "')") to hit the method in utils.js
at 22 Sep 2017
Stephan Luis
To follow on with another question about the same topic ... I've just been setting up an edit method for an Ajax list returning `return Json(new { sg.SGId, Content = this.RenderPartialView("ListItems/SGFacesItem", new[] { editedSG }) });` and the list wouldn't update on Success. Changing the Json to 'sgcvm.Id, Content' restored the js update of the list. The two Ids are the same Guid, wondering what the requirements for the Json are? ... No errors.
at 13 Apr 2018
Stephan Luis
You can see the requirement in the success function, my guess is you need `Json(new { Id = sg.SGId, ...`
at 14 Apr 2018
Omu
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