Git Product home page Git Product logo

ngx-pagination-data-source's People

Contributors

alexfarrugia avatar bulldog98 avatar dependabot[bot] avatar divstar avatar nilsmehlhorn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-pagination-data-source's Issues

Initialising Page Number

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

Use pagination data source to modify items on the active page?

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?

Use deepMerge for the queryBy method

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 ๐Ÿ‘ )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.