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

@pluritech/ng2-responsive-table

v1.2.1

Published

A table responsive component for your angular project.

Downloads

40

Readme

ng2-responsive-table

A table responsive component for your angular project.

Installation

$ npm install @pluritech/ng2-responsive-table --save

Then, import Ng2TableModule

import { Ng2TableModule } from '@pluritech/ng2-responsive-table';

and add it into your AppModule


@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    Ng2TableModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

This library depends of bootstrap styles, so, ensure that is correctly installed and imported.

Usage

In your component template, do the following:

<ng-table [data]="data"></ng-table>

So, in the typescript you will need:

public data: TableContent = {
    columns: [
      {id: 'name', name: 'Name', width: '50%'},
      {id: 'age', name: 'Age'}
    ],
    rows: [
      { data: { name: 'Mateus', age: '23' }},
      { data: { name: 'Lucas', age: '26'}}
    ],
    actions: [
      {name: 'Add Something', class: 'btn btn-primary', icon: 'fa fa-plus',
      condition: row => {
        console.log('condition', row);
        return true;
      },
      disabled: row => {
        console.log('disabled', row);
        return true;
      },
      handler: row => {
        console.log('handler', row);
      }}
    ]
  };

The TableContent type in details

The columns of the table receive each an id. This id, has to be used in the rows to fill the table correctly. The actions columns, receive the following

Field | Description ------ | ----------- name | Text of the button class | css class name to be applied to button icon | css class name icon to be applied to button condition | a function which receives a row and returns a boolean indicating whether this current action button should be displayed disabled | a function which receives a row and determines whether this current action button should be disabled handler | a function who can receive the row and will be executed when the button is clicked

You can also set noRowsMsg to show when no there data on table. Default is: Nenhum registro exibido

Working with checkboxes columns

If you need a column of checkbox in your table, where, the table header of this column will mark all registers you can do the following:

    columns: [
      {id: '', name: '', checkbox: {singleName: 'Marcar'}},
      {id: 'name', name: 'Name'},
      {id: 'age', name: 'Age'}
    ],

the singleName property is the label of every checkbox on mobile screen. To get all the changes in the selected rows, you'll need to pass a function to the following two outputs properties:

  <ng-table [data]="data"
      (selectedChange)="onSelectedChange($event)"
      (selectedChangeAll)="onSelectedChangeAll($event)"></ng-table>

Event | Description ------ | ----------- selectedChange | Will fire every time a single row change the selected status. The event will send the array with selecteds rows selectedChangeAll | Will fire every time the table header button change the selected status. The event will send the array with selecteds rows and a boolean indicating if isAllSelected or not.

License

MIT © Pluritech