Cakephp 2.0 Pagination with dropdown - cakephp

I am doing pagination in cakephp. By default there is a list in
"$this->Paginator->numbers" but i want some changes in pagination design so i want all pages in dropdwon and current page is selected in dropdown. I successfully get the dropdown by writing the following code but the problem is that when i click on the page it wil not change
thanks in advance
`
< select>
echo $this->Paginator->numbers(array('tag'=>'option'));
</select>
`

You have to bind event onChange to your select element with JS. It should redirect you to selected page. You can see how to construct jump url in cake's documentation. You can also use this solution but notice it was written for cake 1.x and will need some changes.

Related

Runtime preview of selected html template

I am new in angular2.I am working with angular 2 and facing issue as follows
1]I have been designed 2-3 template like email template,sms template which will take predefined data and display that data
2]I have been designed screen which contains dropdown with name like email,sms etc
email option has link to email template and same for sms.
The main thing is i want to show the selected template view as a preview of that template.Means if i select sms then the sms template will be shown in given section of the same page.(like upload image preview.)
is it possible?
Thanks ..
Yes obviously, you have to use Routuing for the same, by using routing in angular2 you will be able to
navigate throughout the pages and you can show whatever page you want to display
see also :-
https://angular.io/docs/ts/latest/guide/router.html
latest Updated to angular2 RC1 (wroth reading)
https://coryrylan.com/blog/introduction-to-angular-2-routing
Angular 2 router examples + #Routes typing support
How to use child routes in Angular 2.

Having a default value in ng-options in angularjs but also having persistence when we get back to the form again

My current scenario is i query a service and bring an array of values and display it in dropdown in AngularJS using ng-options. The problem is i need a default value at the top of the dropdown somthing like "Select from the list".
I have done that using
<option value="">Select from the options</option>
the problem is i also need to persist the data when i select suppose first value in the dropdown and go to some other page for sometime and come back to the same page which has that dropdown. That time i again need to see the first item selected and not the "Select from the options" thing.
How can i add this text "Select from the options" to the array which comes after querying a service and populates the dropdown also maintaining the persistence using ngModel.
Thanks,
MK
Assuming that the "other page" is still in the same (single-page) Angular application, you can store the selection in a factory and when you come back to the page, initialize the ngModel object (in the controller) by reading it from the factory. There are many ways, but this is one of the usual basic patterns in Angular.
If the visit to the "other page" causes Angular to be reloaded, one typical approach is to store the settings in local storage.

Don't show dropdown choices with angular-ui-select before entering data?

I am using the angular-ui-select directive to create an auto-complete input field. I want to be able to click and focus the field without the dropdown options appearing. The Plunker example in the documentation works this way, but I cannot get mine to behave correctly. Please help.
Here is my code:
<ui-select ng-model="customer.selected" theme="bootstrap">
<ui-select-match placeholder="Start typing..">{{ $select.selected.family_name }}</ui-select-match>
<ui-select-choices repeat="customer in customers | filter: $select.search">
<div ng-bind-html="trustAsHtml((customer.family_name | highlight: $select.search))"></div>
</ui-select-choices>
</ui-select>
Here is their Plunker example that is working the way I would like it to.
http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview
I have a same issue. I want to be able to click and focus the field without the dropdown options appearing.
Here I am sharing my solution. May be it will help someone. I made changes in Selectize theme example in plunker shared by #Corey Quillen. I had cleaned up other things so it will help.
1) Here first I had add reset-search-input="false" in ui-select directive. So it will not reset search input.
2) Then I had replaced filter with custom filter propsFilter. Which is already useing in Select2 theme. And put
if(!props.name.length){
return out;
}
in filter above If condition. In demo.js file.
So data return empty if no search text entered.
Here is the plunker example of that.
ui-select by default shows a dropdown, I dont think we can change that. But you can change its binding data. In the plunker example the ui-select is bind to model 'address.selected', which initially is empty, thus nothing pops up. But once you start typing the refresh will call the function refreshAddress() to populate the results into address. Once the results are populated, ui-select finds that its model(address) has data and start showing a dropdown. After you have searched for something, try to click on the textbox, it will still show you the result, beacuse they are still present in the model.
Since, you are trying it with a local variable I suppose, it is pre-populated with data for ui-select and hence it shows it. I think you should try to make a request in you code to get that data and use refresh and refresh-delay. If you dont have a web service and want to use local data, I would suggest bind the select to an empty model and put data into that using a custom function for refresh, you might have to write a custom search functionality into the refresh function, but you can use javascript's search() or indexOf() for that.

Set focus on autocomplete field

I have a form that has some fields.
One field is autocomplete
.
The field is filled with information from a table
$f->addField('autocomplete','idfield','Field')->setValueList( $this->api->db->dsql()
->table('items')->field('id,name')->do_getAssoc() );
I'm trying to set the focus on that field when the page loads.
I have did this
On top of the page
$p->js()->_load('seteo_foco');
And then
seteo_foco.js
$(function(){
$("select:first").focus();
})
But this does not work.
Anybody can help ?
Thanks
Try TRUE like
$this->js(true)->_load('seteo_foco'); to load js file.
But in your js code your selector is incorrect. You need to specify you unique field. I'd use something like $form->getElement('field_name')->js(true)->focus(); on the page after the form has been initialized.

Angular UI bootstrap: Type ahead select multiple

I am using angular UI bootstrap type-ahead directive for type-ahead in a form
http://angular-ui.github.io/bootstrap/
I am fetching the records from remote server via $http service. It is working fine.
However I can select only one element from list at a time.
I want to select multiple values from the list and show all currently selected element in input field with a remove button just like tags for SO. The selected tags are stored in angular array model.
How to achieve this ?
I have read documentation for Angular UI bootstrap but I am not able to find anything.
This guy made a directive for this. Should do exactly what you want and it's even using the ui-bootstraps typeahead.
https://github.com/mbenford/ngTagsInput
The best solution I have found so far is io.select
it does exactly what you require, multi-select typeahead.
and the markup is neat and clean too e.g:
<oi-select
oi-options="list.id as list.description for list in lists"
ng-model="tags"
multiple
placeholder="Select">
</oi-select>
This component is also compatible with bootstrap and the new bootstrap 4.
In js file :
To list all selected items, use $item with typeahead-on-select and push to an array for ex.evtMem. delete fn to delete selected item.
HTML :
Use table to list all array values using ng-repeat. Addition to that add remove glyphicon image and function to delete corresponding item.

Resources