gilbert
gilbert

Reputation: 318

Reload page on add or edit of Jqgrid submit

I have a jqgrid on my page which i use for adding data. I use the dialog method to add but when the user submits, i want to refresh the entire page, not just the grid.

Does anyone know how I can achieve this?

$("#addSpecialItem").click(function () {
            jQuery("#specialItemGrid").jqGrid('editGridRow', "new",
                { height: 380,
                    addCaption: "Special Item",
                    bSubmit: "Add to Order",
                    closeAfterAdd: true,
                    afterRefresh: function () {
                        window.location.reload();
                    }
                });
        });

Upvotes: 0

Views: 1864

Answers (2)

gilbert
gilbert

Reputation: 318

I was using afterRefresh instead of afterSubmit, this now reload the page

afterSubmit: function () {
                        location.reload(true);
                    }

Upvotes: 2

Abhilash
Abhilash

Reputation: 1610

Try using location.reload() in your callback

Optionally you can use location.reload(true) to make sure that the page is loaded afresh from the server rather than the browser cache

Upvotes: 0

Related Questions