I have a list page with a filter form and Im submitting the form using get method. How to pass the querystring parameters along with the pagination links. I have checked this link
CakePHP pagination and the get parameters but this->passedArgs is coming as empty. Im using cakephp2. Whats the best option to solve this ?
This is some code I use in a CakePHP 1.3 project. I believe it should still work on CakePHP 2.0 as well (put this in the view where your filter form is):
// Make sure we pass any set filters to the Paginator helper
$urlParams = $this->params['url'];
unset($urlParams['url']);
$this->Paginator->options(array('url' => array('?' => http_build_query($urlParams))));
Related
I am using form.io (angular JS) to create a form using a JSON object. Also using the 'wizard' mode.
This works well, but i just cant seem to understand how to set the options for the form.
Specifically the breadcrumbSettings.clickable setting, which i need to set to false.
I am creating the form in the HTML like this:
<formio form="formCtrl.formio" submission="submission" ></formio>
I tried setting the 'options' param in the html/JS/accessing the form object. Nothing works.
And i cant find a relevant example for setting the options object using angular js.
Anyone out there knows how to achieve this?
Thanks,
Guy
As per the documentation you have to pass formio-options attribute to the above formtag.
Documentation link: https://github.com/formio/ngFormio/wiki/Formio-Directive
example: <formio src="currentForm" formio-options="{skipQueue: true}"></formio>
You would have to pass json of options applicable to formio here in formio tag.
Here some more link from documentation from official repository: https://github.com/formio/help.form.io/blob/49f570dab40edc87234cc06f4dd833aa7aa03561/_paragraphs/developer/offline/offlineapi.md#request-options
I need to implement a custom pagination where one of the fields needs to be populated by a custom PHP method that cannot be implemented using MySQL - ie, I cannot rely on virtualFields.
I tried to use a custom find type, capturing the after event and populating the custom field but the pagination doesn't work with this custom property.
In practical terms, this is what I do to do:
$readers = $this->Paginator->paginate('Reader', array(
'Reader.account_id' => $this->Auth->user('user_id')
));
$readers would have a status property where it's populated using a PHP method. How can I use this dynamic property and the Pagination component at the same time?
Please use these lines
$this->paginate=array('conditions'=> array('Reader.account_id' => $this->Auth->user('user_id')));
$readers=$this->paginate('Reader');
I have problem with cakephp pagination if i pass GET url
everything work fine if i don't add use GET param
like this
page #2
domain/imsystem/admin/remuneration_points/#admin/remuneration_points/index/page:2
but when i add GET param the like become this
domain/imsystem/admin/remuneration_points/#imsystem/admin/remuneration_points/index/page:2?Employee_name=&Employee_branch_id=1&Employee_departement_id=1
it come which extra 'imsystem', how to remove this?
for the $paginator->options($opt);
this is for normal url
$opt['url'] =
'#admin/'.$this->params['controller'].'/'.str_replace($this->params['prefix'].'_',
'', $this->params['action']);
if with GET param
i set
$opt['url'] = $args;
which is array
Array (
[url] => Array
(
[?] => Employee_name=&akhir_tanggal=&Employee_branch_id=1&Employee_departement_id=1
)
)
Please verify your html urls
they proubly have something like <a href ="#imsystem/">
It's not apparent where the second imsystem comes from as the code which is apparently responsible for defining that is in the question. However:
That won't work
Unless you're using js (in which case - you don't really need js for defining the pagination links) - if you have a url of the form:
example.com/imsystem/admin/remuneration_points/#admin/remuneration_points/index/page:2
The only thing that is seen server side is:
example.com/imsystem/admin/remuneration_points/
The url fragment only exists on the browser, which means that irrespective of the url, it will be page one with default sort/limit/order.
It's probably a good idea to setup pagination using get parameters, which will "just work" and go from there.
I have a standard cakePHP backend but I'm not using the cake pagination helper. My existing frontend provides pagination params in the form "startIndex, numberOfResults" vs. "page". It would be great if from within the controller action I could just parse my startIndex, numberOfResults params, calc the proper page and then do something like:
paginate['page'] = $pageNumber;
before the paginate() call. No such luck. So my question is, how can I set the paginator page from within the controller? As a bonus: Where is cake parsing the page named param? Where does it store the page value used for the paginate call?
Since It's a 1.2 application. You should try changing $this->params['url']['page'] like this:
$this->params['url']['page'] = $pageNumber;
Source: CakePHP 1.2
I have a search form.
The form values are passed to query and results are displayed as expected.
I am using Cakes built in pagination methods.
On the initial search, I need the url to reflect the search path values as when I use the sort() or Next >> pagination methods.
When I use sort() or Next >>, my url is formatted with the paginator structure like:
// pagination to Next page note Page 2
...plans/search/55/22/1/0/33758/page:2
When I do the first search I get url:
...plans/search/
Here are the appropriate fragments of my search action:
function search(
...
// query and other action code here unrelated to pagination
...
// start of applicable array and pagination code
$url = array('controller' => 'plans', 'action' => 'search');
$this->paginate = $options; // $options is my query
$this->set('searchdetails', array_merge($url, $searchdetails)); //$searchdetails isi any array of the values entered in the search input boxes. Joining my url and search details.
$this->set('plans', $this->paginate('Plan'));
I tried to break down the above to ONLY include what is applicable to my problem.
NOTE: I am running a default "order" through this action in my query and its working fine, but is not reflected in the url.
I need to know how to update the url to reflect the initial search input results. I have ALL of the array data passed to my view just fine.
I tried recreating the path with a rather large method I wrote, but it did nothing but complicate my problem...
Is there a simple Cake type solution for this? Or is this just not in Cakes cards currently?
Please set me straight on this.
Have you tried
echo $this->Form->create(null, array('url' => $this->passedArgs));