I have the following ajax link for and enabled/disabled image switch.
works fine but it updates the whole page
(itemsdiv) instead of only 1 a single table cell (updatehere)...

I can make it only to show 0 or 1 but cant create ajax->link with
pictures..

Any suggestion would be appreciated :)

VIEW:

<div id="itemsdiv">
<table>
...
<td><div id="updatehere"></div>
<?php echo $ajax->link(($item['Item']['active'] == 1?$html-
>image('admin/enabled.gif'):$html->image('admin/disabled.gif')),
'null', $options = array('url' => '/items/changestatus/'.
$scene['Scene']['id'].'/active/', 'update' => "itemsdiv"), null,
false); ?>
</td>
...
</table>
</div>


CONTROLLER:

function changestatus ($id,$sub) {
    $this->Item->id = $id;
    $item = $this->Item->read();
    if($scene['Item'][$sub] == 0)
    {
    $item['Item'][$sub] = 1;
    }
    else
    {
    $item['Item'][$sub] = 0;
    }
    $this->layout = 'ajax';
    $this->Item->save($item);

    ($this->RequestHandler->isAjax() > 0) ? $ajax="ajax" : $ajax="";
    $this->redirect('/items/index/'.$ajax);
}



Thanks,

Andras Kende


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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