I got it

  $pagination->sortBy('sname', 'Supplier', 'Supplier'),
            $pagination->sortBy('name','Customer','Customer'),

On May 15, 2:03 pm, Enchy <[EMAIL PROTECTED]> wrote:
> What do I change to this to get "sname" in my while loop?
>
> <?php
> class Order extends AppModel {
>    var $name = 'Order';
>
>     var $belongsTo = array('Customer' =>
>                          array('className'     => 'Customer',
>                                'conditions'    => '',
>                                'order'         => 'name ASC',
>                                'limit'         => '',
>                                'foreignKey'    => 'customer_id',
>                                'dependent'     => true,
>                                'exclusive'     => false,
>                                'finderQuery'   => ''
>                          ),
>                           'Supplier' =>
>                          array('className'     => 'Supplier',
>                                'conditions'    => '',
>                                'order'         => 'sname ASC',
>                                'limit'         => '',
>                                'foreignKey'    => 'supplier_id',
>                                'dependent'     => true,
>                                'exclusive'     => false,
>                                'finderQuery'   => ''
>                          )
>
>                                 );
>
> }
>
> ?>
>
>  function index() {
>
>         $criteria=NULL;
>         list($order,$limit,$page) = $this->Pagination->init($criteria); // 
> Added
>
>         $data = $this->Order->findAll($criteria, NULL, $order, $limit,
> $page); // Extra parameters added
>         $this->set('data',$data);
>     }
>
> $pagination->setPaging($paging); // Initialize the pagination
> variables
> $th = array (
>             $pagination->sortBy('id'),
>             $pagination->sortBy('dateoforder'),
>             $pagination->sortBy('eta'),
>             $pagination->sortBy('sname'),
>             $pagination->sortBy('customer_id'),
>             $pagination->sortBy('total'),
>             $pagination->sortBy('ref'),
>             $pagination->sortBy(' ')
> ); // Generate the pagination sort links
> echo $html->tableHeaders($th); // Create the table headers with sort
> links if desired
>
> foreach ($data as $output)
> {
>     $tr = array (
>
>         $html->link($output['Order']['ordernum'], "/Orders/Edit/
> {$output['Order']['id']}"),
>         $output['Order']['id'],
>         $output['Order']['eta'],
>         $output['Order']['sname'],
>         $html->link("Delete", "/Orders/Delete/{$output['Order']
> ['id']}",null,'Are you sure?')
>
>         );
>     echo $html-
>
> >tableCells($tr,array('class'=>'altRow'),array('class'=>'evenRow'));
> }
>
> I tried playing around with findall but Im not sure how to print it by
> output and orderby?
>
> L


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