开发者

Delete jqGrid rows client-side only and sending deleted rows to ASP.NET MVC on form POST

The question is likely confusing and I apologize. I wasn't sure how best to word it.

I am using jqGrid in a jQueryUI dialog开发者_Python百科 which is inside a form. The user will use this form to create and edit Events.

Upon editing, the user can click a button to open a dialog showing a grid of saved locations for the event. I want to give them the ability to remove saved locations, but I don't want to delete them right away on the server because they may decide to not save the changes on the main form.

What I'd like to do is build an array containing the IDs of what locations they delete with the default delete navigator delete button. When I confirm deletion of rows, it wants an editurl, but I don't want to delete them right now.

Is there a good way to track their deleted records and then delete them once they save the event? I am wondering if I should create a server-side collection/file and read it once the Event itself is saved; I have no idea what the best approach is for this.

Thank you in advance :)


Here are some high-level guidelines for how you can accomplish this:

Instead of using the navigator's delete button, you could create your own button - name it delete and give it a custom event hander. Then when a row is deleted, add its ID to an array of deleted rows, and update a hidden field in the form which contains all of the deleted rows. When the form is POST-ed back to the server, this field can then be used to do the actual deletes.

To save the ID's to the hidden field, you could use the stringify method from json2.js to write it as JSON. You would then need to decode the JSON array using ASP.NET MVC to extract the ID's.

Does this help at all?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜