Hi there,
I'm trying to do a very simple thing, I'm sure there is something
important missing - I just started a few days ago with CakePHP.
I want to display an expenses table with pagination and two controls
for filtering the year and month.
The filtering works fine, the pagination as well, but no together.
let's say I apply a date filter in the query, then the view displays
correctly the results, with the correct page numbers (Page 1 | 2) etc.
then I click on "Page 2" and the filter is not applied anymore showing
the whole table.
This is my controller:
expenses_controller.php
function index ()
{
$this->pageTitle = 'Your company Expenses';
$month = $this->data['Expense']['month'];
$year = $this->data['Expense']['year'];
$data = $this->paginate('Expense', array ("Expense.stamp LIKE '%
$year-$month%'"));
$this->set(compact('data'));
}
And this is my view:
index.ctp
...
<!-- two select boxes to filter by year and month -->
<?= $form->create('Expense', array('type' => 'post', 'action' =>
'index')); ?>
<?= $form->month ("", $this->data ["Expense"]["month"], array (),
false); ?>
<?= $form->year ("", 2000, 2020, $this->data ["Expense"]["year"],
array (), false); ?>
<?= $form->end('View'); ?>
...
(iterate results)
...
Go to Page: <?= $paginator->numbers(); ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---