Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngfb_sortable_table

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngfb_sortable_table

Angular 2+ Firebase Sortable Table

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Angular 2+ Firebase Sortable Table

What is Angular 2+ Firebase Sortable Table (AFT)?

AFT is A2+ module giving a solution for common problem - creation a table with firebase as a backend. It was decided to avoid using third part services as firebase cloud functions or writing own observer servers using node. Before you start it is strongly recommended to read an this article.

List of components:

Install:

npm install @nodeart/ngfb-sortable-table --save

Description:

Module is supplied with set of features that could be useful while working with tables such as search, sort, filter and infinite scroll. Due to limitations of firebase querying there are no complicated logic under the hood. According to firebase documentation one can use only one orderBy query at a time.

Basic Usage

Events table:

There are 4 types of events could have happen. Each of them has its own querying rules and usage restrictions.

EventsInfiniteScrollSortByHeaderFilterByInputFilterBySelect
Reset previous queryfalsetruetruetrue
Basic query{orderByKey: true}{limitTo(First/Last): number, orderByChild: field}{orderByKey: true}orderByChild: field
Prioritymediumlowlowhigh

Events details:

  • InfiniteScroll:

    InfiniteScroll is a default event and first request to database will be done with it if no config for FilterBySelect provided; It is the only event that doesn't reset previous query, only add the offset. Fires when user is reached the bottom of the page.

    Restrictions:

    • @Input pagination is passed;
  • SortByHeader:

    SortByHeader is an event that happen after toggling the arrow button on sortable header items.

    Restrictions:

    • field to be sorted by has primitive value;
    • field to be sorted by is not nested inside the object;

    Resets other queries.

  • FilterByInput:

    FilterByInput is an event happen when user input some data in a search string. Input is debounced by default.

    Restrictions:

    • field to be filtered by is a string;
    • field to be sorted by is not nested inside the object;
    • @Input filterByInputValue is passed in;

    Resets other queries.

  • FilterBySelect:

    FilterBySelect event has the greatest priority value. If it is passed in than the first request to database will be made by the rules of this event.

    Restrictions:

    • field to be filtered by has primitive value;
    • field to be filtered by is not nested inside the object;
    • @Input filterBySelect is passed in;

    Resets other queries.

Usage tips:

  • To improve firebase query performance use .indexOn rule in your database rules.
  • The selector of TableItemComponent that you pass inside SortableTableComponent must be attributive in order to be properly displayed. Example: tr [sortableTableItem].
  • To sort your headers use PriorityKeysPipe and pass enum with a list of headers as an argument and the list of headers you'd prefer not to show.
  • Always bind setHeaders function to your container component context (see basic usage) if you use this keyword in this function. As child component doesn't not know who his parent actually is, we can't use forward ref to done this.

List of dependencies:

Keywords

FAQs

Package last updated on 19 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc