in the near future (much like the rest of the world, even my
grandmother, and she doesn't even have a computer!).
I use jQuery to add an extra row by cloning the last row, incrementing
the ids and names of the elements and appending it to the container.
Works very well without the need for any "ajax".
Cheers,
Adam
On Jan 3, 7:31 am, "rhythmicde...@gmail.com" <rhythmicde...@gmail.com>
wrote:
> Can someone please give me some pointers on this? I have a table. I
> have a button that when clicked should called an action. That action
> should return the HTML for a new row. The row should then be appended
> to the table.
>
> If I use 'update' in the options array the entire content of the page
> is put inside the row.
> If I use 'append' in the options array nothing happens.
>
> echo $ajax->link('Click Here', 'edit/', array('update' => 'mytable'));
>
> I have looked through the manual and found nothing. I reviewed the API
> and followed the link to the definition of ajax->link but did not find
> anything to help.
>
> I have been advised to use jQuery. But I want to make it work with
> what CakePHP recommends.
>
> Thanks for any help.
>
> VIEW
>
> <h2>Testing AJAX with CakePHP and Prototype and Scriptaculous</h2>
>
> <table id="mytable">
> <tr id="row1">
> <td>Row1</td>
> </tr>
> </table>
>
> <div id="mydiv">
> This is a div
> </div>
>
> <?php
> echo $ajax->link('Click Here', 'edit/', array('update' =>
> 'mytable'));
> ?>
>
> ACTION
>
> function edit()
> {
> $this->pageTitle = 'Edit Page';
> if($this->RequestHandler->isAjax())
> {
> $this->layout = 'ajax';
> echo '<tr><td>This is a row</td></tr>';
>
> }
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment