Primeng paginator rowsPerPageOption support for 'All' - primeng

I'm wondering if there's an equivalent solution (in primeng) to have an "All" option for rowsPerPageOptions. Currently the only way to solve this is to add a very large number, but this isn't ideal\optimal: for instance.
<p-table #dataTable
[lazy]="false"
[value]="primengTableHelper.records"
[paginator]="true"
[rows]="rowsPerPage"
[rowsPerPageOptions]="[5,10,25,50,100,100000]"
[scrollable]="true"
ScrollWidth="100%"
[resizableColumns]="true"
(onFilter)="onFilterChange()"
sortMode="multiple" [multiSortMeta]="multiSortMeta">
I've tried adding an 'All' option, but it doesn't trigger any kind of event to be able to handle it in a custom manner (only fires events on numeric values). Does anybody have any ideas on how I can solve this without an entirely custom solution (or the cheesy large number to catch all records). Thanks.

Use this config:
[rowsPerPageOptions]="[1,20, 50, { showAll: 'All' }]

Related

API Platform - Handling pagination against a big database

I'm having some issue with API Plateform performance, against a 35.7 GiB database i'm trying to expose.
I'm using the collection pagination feature, because it is a need. For most of my queries it is working ok because they contains filters limitating the set of results.
Only for the default query (without filter) the count query is taking a very long time (10k seconds). So i was hopping to find some way prevent the pagination to happen in this very case, as i'm not able to prevent this kind of API usages.
I looked into the README, the code and documentation about performance but didn't find a sufficent answer, so i tried overriding the PaginationExtension service:
I rewrote the isPartialPaginationEnabled() method just to replace the first line, but i'm not satisfied with the result.
So i'm asking if there is maybe a way i didn't see, or maybe an other approch to the problem. Any help would be welcome.
Thanks by advance.
I don't know if i get you right. But you can disable count query to improve pagination performance, check below my config for this situation.
#api_platform.yaml
collection:
pagination:
client_enabled: true
enabled_parameter_name: 'pagination' # optional
client_items_per_page: true # Disabled by default
items_per_page_parameter_name: itemsPerPage # Default value
partial: true
client_partial: true # Disabled by default
partial_parameter_name: 'partial' # Default value

How to click the buttons without element id

Im using protractor for e2e testing.I want to click the buttons
Is there any reason you're not using the Protractor API, but the driver directly? Selecting by ng-click might not be the best approach here as well (good practice seems to be selecting based on page structure, not mechanics), I would recommend you to investigate if you can't simply use by.buttonText:
element(by.buttonText('Place Order'));
EDIT: Looking at the way the selector is made, the above will not work - please note by.buttonText will only match:
button
input type="button"
input type="submit"
I'm keeping this for anyone who might need this in the future.
If that will not work, maybe you could at least select it by class, e.g. inside a parent? For example:
element(by.css('.btn-wrapper > .btn:nth-child(2)'));
Also, consider adding a separate class/id for the button, it might be useful later anyway.
Last remark, if you have a large page to test, consider using page objects instead of selecting same stuff in separate steps. This way, instead of writing the selector, you'll have a nice, maintainable object, that you can use like:
myPage.placeOrderButton().click();
Just something to consider.
Place order button:
$('[ng-if*="checkout"]').click();
Cancel button:
$('[ui-sref=​"main.store.featured"]').click();
This should work:
element(by.css('[ng-click="ctrl.placeOrder()"]')).click();
I think the simplest and the most readable approach here would be to locate the element by text:
element(by.xpath('//div[. = "Place Order"]'));
You may just need to add a wait for element to become visible:
var EC = protractor.ExpectedConditions,
placeOrder = element(by.xpath('//div[. = "Place Order"]'));
browser.wait(EC.visibilityOf(placeOrder), 5000);
placeOrder.click();
I don't know if this will help, but I found an article where someone was having issues clicking on a div. It seems a bit much for just clicking on a div but I figured the link could help you out
https://adventuresintesting.wordpress.com/tag/protractor-doesnt-click-div/

Override Drupal view field formatting?

I have a content type called "thing". A thing can have a "size", that is either "small", "medium" or "large". For a specific view, I want to change this output to rather say: "100 Square Meters" for small, "200 Square Meters" for medium and "300 Square Meters" for large.
What is the most elegant solution to do this? I don't want any weird if and else logic in my view, or worse yet, use Views PHP. Isn't there any easy way to add a field like this with multiple values, but output it in a certain way for a specific view?
UPDATE
I was considering using this.
You can do that in many ways , the most simple way is to override the template field for that field
Check out this tutorial
One more way using custom_formatters module which let you create custom format using token , which should be simple for you
If you will do this one time only, better to do with the first way, no need to install module you will use it only for one time

Best options for an AngularJS Tree Grid

For a while now, I've been looking for a Tree Grid that works nicely with AngularJS and haven't had a lot of luck.
My requirements are:
Easy to use
Looks good
Supports drag and drop
Can handle large amount of data 10000+ (i.e pagination/lazy scroll of 10,000+ rows)
Can show hierarchical data in a table (i.e columns/sorting)
Free/Cheap
Projects that come close:
Sencha Tree Grid
Doesn't appear to play nicely with AngularJS
Apparently a Buffered-Tree module can help handle 1000s or rows
angular-ui-tree
Close but doesn't support table functions like columns, out of the box
Doesn't handle large data, but Michael Bromley's dirPaginate directive can fix this
tree-grid-directive
Looks good (Fits with bootstrap)
Has columns
But doesn't easily allow for pagination/lazy loading
Ok... so given that other people must have solved this before, my question is:
What is the best way to approach this?
Is there a project out there already that covers all the bases?
Or perhaps there is a simple way to adapt one of these to be a lazily-loaded tree grid...
I know its a two months old question, but I needed the same thing and just came across this grid Adapt-Strap.
I used it some small examples and worked fine so far, seems really easy to use, has drag-drop/pagination/lazy loading.
I think its worth a try, and fyi: I have no connection what so ever with the developers there.
IgniteUI Tree Grid (not to be confused with the ugly Hierarchical Grid)
Whilst not perfect, this seems like a reasonable option.
Pros
Looks nice enough
Has a few plugins for sorting, filtering, paging, pinning etc.
Lazy loading of children can be integrated by listening to expand events (and possibly the InfragisticsLoader)
Cons
No out-of-the-box AngularJS integration
No "Infinite Scroll" out-of-the-box
Its also pretty simple to use:
$("#treegrid").igTreeGrid({
width: "100%",
dataSource: data,
primaryKey: "employeeID",
columns: [
{ headerText: "Employee ID", key: "employeeID", dataType: "number" },
{ headerText: "Name", key: "name", dataType: "string" }
]
});
I have created a sample jsFiddle here: http://jsfiddle.net/immersion/qggbs0s6/
My Suggestion would be Angular UI-Grid. In its current version, there are many configuration options, also for Trees:
Website: http://ui-grid.info/
Expandable Grid: http://ui-grid.info/docs/#/tutorial/216_expandable_grid
Angular Tree Grid seems like a nice option if you want to be able to edit nodes.
As of version 2.7, it does not support drag & drop reordering, sadly.
Demo: https://angular-tree-grid.stackblitz.io/add_edit_delete
Use JS Tree
http://ezraroi.github.io/ngJsTree/?utm_source=angular-js.in&utm_medium=website&utm_campaign=content-curation
Lazy Load in JSTree :http://www.miketyka.com/2012/10/lazy-loading-with-jstree-and-ajax/

CakePHP Filter Search

I need to build a filter search that returns data using the criteria set.
My problem is building the search. It needs to be a OR query because anyone of them could be selected.
http://img200.imageshack.us/img200/2527/screenshot20100118at095.png
This is what will be searched.
Accommodation.space
Accommodation.room_type
Accommodation.facilities
Accommodation.speaks
The only way I can think of doing it is an if statement for each input, but that would be 15 if statements, is there a better way?
$Model->postConditions($this->data) [reference] can do this for you.
It will auto-generate Cake compatable conditions array, and you can even specify if you want it to be an "AND/OR" operation
This is a nice component which could likely be tweaked to work for you. It might even work right "out of the box"
http://www.jamesfairhurst.co.uk/posts/view/cakephp_filter_component/
Here is a new tutorial about this. Might help: http://www.youtube.com/watch?v=FAVuLXFVaCw

Resources