distinct with php and datatables
distinct with php and datatables
Hi,
I have working datatables on my site, for server-side processing I'm using this code (cakephp 2.x):
[code]
$this->paginate = array(
'fields' => array(
'Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice', 'Item.serialNumber'),
'link' => array(
'Producer' => array(
'fields' => array('name')
),
'Category' => array(
'fields' => array('name')
),
'Supplier' => array(
'fields' => array('name')
)
)
);
$this->DataTable->fields = array('Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice',
'Item.serialNumber', 'Category.name');
$this->DataTable->emptyElements = 1;
$this->set('items', $this->DataTable->getResponse());
$this->set('_serialize','items');
[/code]
But how to make distinct query with it ?
I have working datatables on my site, for server-side processing I'm using this code (cakephp 2.x):
[code]
$this->paginate = array(
'fields' => array(
'Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice', 'Item.serialNumber'),
'link' => array(
'Producer' => array(
'fields' => array('name')
),
'Category' => array(
'fields' => array('name')
),
'Supplier' => array(
'fields' => array('name')
)
)
);
$this->DataTable->fields = array('Item.item_id', 'Item.name', 'Item.properties', 'Item.purchasePrice', 'Item.salePrice',
'Item.serialNumber', 'Category.name');
$this->DataTable->emptyElements = 1;
$this->set('items', $this->DataTable->getResponse());
$this->set('_serialize','items');
[/code]
But how to make distinct query with it ?
This discussion has been closed.
Replies