Hello all

I currently have a sortable list based on what I found <a href="http://
nio.infor96.com/ajax-in-cakephp-sortable/">here</a> it's working fine,
even saving the order on a db table.

controller:

 function admin_ordenar() {

       $this->RequestHandler->setAjax($this);

        if (!empty($this->params['form']['list'])) {

                    $lists = $this->params['form']['list'];

            foreach ($lists as $order_id => $data) {
                $data['order_id'] = $order_id;
                if (!empty($data['id']))
                    $this->Capitulo->save($data);
            }
        }

        $this->set('caps', $this->Capitulo->findAll(null, null,
'order_id ASC'));
    }


        function admin_index() {
                $this->Capitulo->recursive = 0;
                $this->set('item_list', $this->requestAction('/admin/capitulos/
ordenar', array('return'=>true)));
        }

for information sake: im ordering chapters and Im using the order_id
to identify the chapter #.

Problem is I added a "delete" button on every list item (chapter),
when clicked the chapter gets deleted, and the div is updated BUT im
not able to re-sort the list (in order to reset the chapter numbering
in case the user deletes any chapter that's not the last one)

controller:

function admin_delete($id = null) {

                if(!$id) {
                $this->Session->setFlash('Invalid id for Capitulo');
                $this->redirect('/capitulos/index');
                }

                if($this->Capitulo->del($id)) {

                $this->set('caps', $this->Capitulo->findAll(null, null, 
'order_id
ASC'));
                $this->render('admin_ordenar', 'ajax');

            }

}

>From what I'm guessing the sortable list uses a form which it submits,
now how do I submit this form in order to get it re-sorted on the
event that any chapter is deleted?

Thanks in advance


--~--~---------~--~----~------------~-------~--~----~
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