Redirect after insert/update
- Single Page
Posted 12 January 2012 - 21:15 PM
My initial efforts in callback_after_insert were not successful, so I'm poking around in the library, but thought you might have an idea.
Thanks for any thoughts, the library usage continues to be a real success for me.
Posted 12 January 2012 - 21:28 PM
Can you think of a good way to redirect after an insert/update event? Preferrably an onSuccess() sort of thing that would still have access to post parameters.
My initial efforts in callback_after_insert were not successful, so I'm poking around in the library, but thought you might have an idea.
Thanks for any thoughts, the library usage continues to be a real success for me.
[/quote]
You can change the javascript to do all the sucess with a redirection to the list page .
Here is the post of how you can do that : http://www.grocerycr...indpost__p__246 , this is the datatables themes so the similar thing you will change in flexigrid theme too.
The redirection doesn't work if you try it with the header("Location: ...."); or with the redirect of CI. This is normal as all the requests are ajax.
Posted 12 January 2012 - 21:36 PM
$crud->redirect_url
and if it exists add a redirect param to the ajax response, then finally in js
if(data.success)
{
if (data.redirect) {
window.location.href = data.redirect;
}
That should allow me to pass params in there nicely, and have different (or no) redirect for my other screens.
Thanks for the super quick response btw.
Posted 12 January 2012 - 21:48 PM
Great, I had already found my way into the js. Seems like I can put a little hack in as well, on the php side
$crud->redirect_url
and if it exists add a redirect param to the ajax response, then finally in js
if(data.success)
{
if (data.redirect) {
window.location.href = data.redirect;
}
That should allow me to pass params in there nicely, and have different (or no) redirect for my other screens.
Thanks for the super quick response btw.
[/quote]
I think this is even better for you
Posted 24 August 2013 - 20:26 PM
First of all, once again many thanks to the creator of "grocery crud"
for some reasons i would prefer pure "php" solution
to automatically redirect after inserting with "add form" to "edit form"
callback_after_insert unfortunately does not work for this
can someone help me!