ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
Map to grid multiple new items
Title:
B
I
{code}
?
I am using ASP.NET 4.9. I have created a form that a user can input create several items, having a set of common fields, and some fields being different. I can save them to database at the same time. However, I have not been able to figure out where to modify the GridCrud where multiple new items can map to grid so that the new table refresh and show them all. It only show one last record that was saved. I have to manually click Refresh in order for the table to display all new items created/saved. Please advise.
Save Changes
Cancel
Tim
asked at 23 Feb 2016
the crud demo returns the grid row model in the Create post action as a json and on the client side this object is added to the grid (utils.js itemCreated); so you could modify these parts or a simpler solution would be to just call $grid.data('api').load()
at 23 Feb 2016
Omu
I'd need it to automatically refresh the grid post occurs. How do I get $grid.data('api').load() to automatically load in the original grid form, where I have @(Html.Awe().Grid("XXX") ?
at 23 Feb 2016
Tim
when in crud demo view (Visual Studio) find Html.InitCrudPopupsForGrid click on it and hit F12, you'll get to the helper code, note the call to .InitPopupForm().Name("create" + gridId) and see .Success("utils.itemCreated('" + gridId + "')"), when the PopupForm is successfully posted the Success js func will be executed; (http://aspnetawesome.com/learn/mvc/PopupForm); so you can look at utils.js itemCreated copy it and modify or create a small function that calls api.load
at 23 Feb 2016
Omu
Actually, putting $grid.data('api').load() into utils.itemCreated(..) works like a charm. Thanks for your help.
at 25 Feb 2016
Tim
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