nilsmehlhorn / ngx-pagination-data-source Goto Github PK
View Code? Open in Web Editor NEWPagination Data Source for Angular Material
Home Page: https://nils-mehlhorn.de/posts/angular-material-pagination-datasource
Pagination Data Source for Angular Material
Home Page: https://nils-mehlhorn.de/posts/angular-material-pagination-datasource
Hi @nilsmehlhorn , first of all thanks for this class, I think it's really neat and really simplifies lazy-loading for tables or similar components. I have a scenario where I have a page which has the paginated table and a user can navigate away from it and back to it, in order to simplify the user experience and to make things as seamless as possible i am storing all query and request parameters (sort order, page size, page number etc) in the store so when user navigates back all his chosen preferences are retained.
I am not sure i have understood though if it is possible to send in a page number with the initial request which is not 0. Is this possible somehow?
many thanks
Alex
Our last update did not update the peer-dependecies, I already made a pull reqest to fix it.
How can the ngx-pagination-data-source component be also used in applications where the content of the items on the active page can be modified (by user interaction)? I would like for instance to allow the user to edit the items on the active page, and then call a rest-api containing a list with just the items from the actual page, to update for instance a database managed by the web server?
Can somebody please provide same examples about how to use the ngx-pagination-data-source for updating, adding or deleting items in a material table?
Since the queryBy
works with destructoring, nested properties aren't correctly merged.
queryBy(query: Partial<Q>): void {
const lastQuery = this.query.getValue()
const nextQuery = {...lastQuery, ...query}
this.query.next(nextQuery)
}
For example:
const foo = {
item1: 'a',
item2: 'b',
filter:{
filterItem1: 'aa',
filterItem2: 'bb'
}
};
const bar = {
item2: 'c',
filter:{
filterItem1: 'abc',
}
};
const result = {...foo, ...bar};
Will result in:
{
item1:"a",
item2:"c",
filter: {
filterItem1:"abc"
}
}
Might be better to use something like a deep-merge?
Or describe the queryBy
in the Readme and clearly explain, that we need to use a flat QueryObject
https://www.30secondsofcode.org/js/s/deep-merge
Or maybe even better. A typescript variant, which checks the keys with typeof
, extends
, etc.
(btw.. great library ๐ )
Nice lib. But the page size is not respected in the fetch
method.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.