Rename the aliases to be CamelCased and try again. Also, debug the results of $this->paginate() to make sure it includes the MainCity and any other data you are trying to sort by.
-jeremy
On Friday, April 27, 2012 4:45:16 PM UTC-7, Hill180 wrote:
-- On Friday, April 27, 2012 4:45:16 PM UTC-7, Hill180 wrote:
Here is the real example I am trying.
The webpage has a list of work order that are open.
<th><? echo $this->Paginator->sort('Work Order ID','WorkOrder.id') ?></th> //works
<th><? echo $this->Paginator->sort('Customer','Customer.name') ?></th> //works
<th><? echo $this->Paginator->sort('City','MainCity.name') ?></th> //no worky
Customer Model:
var $belongsTo = array(
'main_city' => array(
'className' => 'City',
'foreignKey' => 'main_city_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'billing_city' => array(
'className' => 'City',
'foreignKey' => 'billing_city_id',
'conditions' => '',
'fields' => '',
'order' => ''
),...
var $hasMany = array(
'WorkOrder' => array(
'className' => 'WorkOrder',
'foreignKey' => 'customer_id',
'dependent' => false,
),
Work Order Model
var $belongsTo = array(
'Customer' => array(
'className' => 'Customer',
'foreignKey' => 'customer_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
City Model
var $hasMany = array(
'MainCity' => array(
'className'=>'Customer',
'foreignKey'=> 'main_city_id',
'dependent'=>true,
),
'BillingCity' => array(
'className'=>'Customer',
'foreignKey'=> 'billing_city_id',
'dependent'=>true,
));
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
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
No comments:
Post a Comment