npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-smarter-table

v1.0.2

Published

A comprehensive angular smart table

Downloads

9

Readme

NgSmarterTable

An Angular 5 smart table that handles filtering, sorting, inline editing, deleting, and more!

Installation

For now, this table only supports bootstrap.

NPM

  npm install ng-smarter-table
  • Make sure you have the bootstrap css, along with fontawesome installed in your project. If not, add the following css links to your index.html in the root of your project.

    As per the Boostrap Docs:

    As per the FontAwesome Docs:

    <!-- index.html -->
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" 
    integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
     crossorigin="anonymous">
    <!-- fontawesome -->
    <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  • Add SmarterTableModule to your Module file:

    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        SmarterTableModule
      ],
      providers: [],
      bootstrap: [AppComponent]

Usage

  • Add smarter table to your html component, specifying your rows and columns, at least:

      <smarter-table
            [columns]="columns"
            [rows]="rows">
      </smarter-table>

    Example on columns and rows:

    columns = [
        {type: 'text', visible: true, name: 'First Name', binder: 'fname' },
        {type: 'text', visible: true, name: 'Last Name', binder: 'lname' },
        {type: 'text', visible: true, name: 'Date of birth', binder: 'dob' },
        {type: 'number', name: 'numbers', visible: true, binder: 'nums' },
        {type: 'text', name: 'Gender', visible: true, binder: 'gender' },
      ]
      
    rows = [
      {fname: "Connor", lname: 'Makhlouta', dob: "24/5/1996", nums: 414, gender: "male"},
      {fname: "George", lname: 'Rattel', dob: '14/5/1992', nums: 4414, gender: "male"},
      {fname: "Sabrina", lname: 'Azar', dob: '16/1/1997', nums: 4414, gender: "female"},
    ]
    

    Column

    | Attribute | Values | Description
    | --- | --- | --- | | type | 'text'/'number' | Type of the column to be stored, used in identifying for sort and filter | name | any | Name to be shown on column | binder | any | Property name in row for this column to be bound to

    Additional Features

    Smarter Table supports filtering, sorting, pagination, inline editing, and exporting to excel.

    • Sorting: Depending on the type given in the column, the sort will execute, whether a number or string

    • Filtering: Depending on the type given in the column, a filter can be used, whether number or string

    • Pagination: Depending on a page length specified, different page sizes can be given

    • Export to Excel: Speaks for itslef

    • Inline editing: If enabled, user can edit a record inline, while specifying a function in order to be run on save, in case of updating an external source. User is then urged to refresh data source

    • Filtering by column: User can set which columns are to be visible and which are not to be

    Inputs

    | Attribute | Type | Default | Description
    | --- | --- | --- | --- | | filter | Boolean | false | Whether or not to enable filter | can_delete | Boolean | false | Whether or not to show a delete button | can_edit | Boolean | false | Whether or not to show a edit button | inline_edit | Boolean | false | Whether or not a user should be able to inline edit on the table | inline_edit_group | array | [] | Description of inline edit types to be used. Dropdown/text | pagination | Boolean | false | Whether or not to enable pagination in the table | page_size | Number | null | Page size in case pagination is enabled | can_export | boolean | false | Whether or not data can be exported to excel | primary_action_name | string | "Edit"| Name of button to be set on primary btn. Note: this button still binds to the (edit) function | secondary_action_name | string | "Delete"| Name of button to be set on secondary btn. Note: this button still binds to the (delete) function |

    Outputs

    | Attribute | Type | Default | Description |
    | --- | --- | --- | --- | | edit | Function | null | Function to be executed on edit click | delete | Function | null | A delete function to be executed when user clicks delete | save | Function | null | Function be run on when a user clicks save for inline edit | cancel | Function | null | Function be run on when a user clicks cancel for inline edit | row_click | Function | null | Function to handle user row clicks

    An example of inline_edit_group can be seen below:

     inline_edit_groups = [
         {
           binder: 'nums',
           type: 'dropdown',
           options: [1,2,3,4,5]
         },
         {
           binder: 'strs',
           type: 'text'
         }
    ]
     

Dependencies

This project makes use of the ng2-multiselect library created by preetham1290.

Example code

Example code can be found in the Smarter Table Module

Live Demo

TODO