On 18 abr, 09:22, mutabor <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have list of items ( index() in controller ), each item has 'Delete'
> button that point Ajax call to delete() function in controller, then
> updates the div of items.
>
> In delete() function, after actual deletion of record I need to return
> to the same view and call index() function again - to let it again
> generate all listing. And I have problems with it.
>
> Right now I do it like this:
>
> [repeat all code from index() function]
> $this->render('index','ajax');
>
> The solution will be easy if render('index', 'ajax') will not just
> show index view but also call index() in controller before and I would
> not have to repeat code as I do it now.
>
> RequestAction also does not seem to be helpful.
>
> Please help.

IMO it's a bad idea to hardcode the layout to be ajax. for one, if it
isn't an ajax call your pages don't look nice ;).

Probably better to write your code so that it works without using js,
include the RequestHandler component in yoru app controller and
override the redirect function to do something appropriate if called
as part of an ajax call. See:

http://groups.google.com/group/cake-php/browse_frm/thread/23eb2bfe8ea8167e/b01390ae19bfd380?lnk=gst&q=isAjax+requested+redirect&rnum=1#b01390ae19bfd380

hth,

AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to