Giter Site home page Giter Site logo

angular-table-builder's Introduction

Angular Table Builder

The Angular Table Builder includes a comprehensive set of ready-to-use features covering everything from paging, sorting, filtering, editing, and grouping to row and column virtualization, and accessibility support.

$ npm install --save @angular-ru/ng-table-builder

After a few seconds of waiting, you should be good to go. Let's get to the actual coding! As a first step, let's add the Angular table builder module to our app module (src/app.module.ts):

import { TableBuilderModule } from '@angular-ru/ng-table-builder';

@NgModule({
    imports: [TableBuilderModule.forRoot() /*, ... */]
})
export class AppModule {}

Simple use

Next, let's declare the basic grid configuration. Edit src/app.component.ts:

import { Component } from '@angular/core';
import { MyData } from './my-data.interface';

@Component({
    selector: 'app-root',
    template: ` <ngx-table-builder [source]="data"></ngx-table-builder> `
})
export class AppComponent {
    public data: MyData[] = [
        { make: 'Toyota', model: 'Celica', price: 35000 },
        { make: 'Ford', model: 'Mondeo', price: 32000 },
        { make: 'Porsche', model: 'Boxter', price: 72000 }
    ];
}

see: https://stackblitz.com/edit/ng-table-builder-simple

The ngx-table-builder provides a styled data-table that can be used to display rows of data. The ngx-table-builder is an customizable data-table with a fully-templated API, dynamic columns, and an accessible DOM structure. This component acts as the core upon which anyone can build their own tailored data-table experience.

Custom template

// app.component.ts
import { Component } from '@angular/core';
import { LicenseSample } from './license.interface';

@Component({
    selector: 'app',
    templateUrl: './app.component.html'
})
export class AppComponent {
    public licenses: LicenseSample[] = [
        {
            id: 1,
            name: 'single',
            price: 29.3
        },
        {
            id: 2,
            name: 'developer',
            price: 49.8
        },
        {
            id: 3,
            name: 'premium',
            price: 99.5
        },
        {
            id: 4,
            name: 'enterprise',
            price: 199
        }
    ];
}
<!-- app.component.html -->
<ngx-table-builder [source]="licenses">
    <ngx-column key="name">
        <ng-template ngx-th>License</ng-template>
        <ng-template ngx-td let-name>
            {{ name | uppercase }}
        </ng-template>
    </ngx-column>

    <ngx-column key="price">
        <ng-template ngx-th>Cost</ng-template>
        <ng-template ngx-td let-price>
            {{ price | currency }}
        </ng-template>
    </ngx-column>
</ngx-table-builder>

TODO:

  • Simple use and setup;
  • Virtual scroll (horizontal, vertical);
  • Auto calculate height;
  • Customisable Appearance;
  • State Persistence;
  • Filtering;
  • Resizing;
  • Sorting;
  • Selection;
  • Context menu;
  • Outstanding Performance (need improved);

angular-table-builder's People

Contributors

splincode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

jonathanlandel

angular-table-builder's Issues

Can this make a cell span columns or rows?

I'm working through a number of different Angular "table builder" modules at the moment, found this one just now and it was by far the easiest to get going with straight-out-the-box. The others that I've looked at so far have simply been way too "over the top" with functionality that my current project will literally never use... However, there are a few small things I'm battling to work out here.

Not sure if I'm just missing something from the examples on the linked stackblitz.io page, but perhaps someone could tell me if ng-table-builder can generate tables with the following example layout:

Table Title
Label: Value Label: Value
Label: Value Label: Value

This involves two things that I haven't managed to work out so far:

  1. Using the colspan attribute to make one header cover all columns (I would also like to use rowspan, but that's not required)
  2. Showing multiple entries per row, so where my source data is an array of 4 entries, and I have 2 on each table row.

Regarding point 2, if this module has no way to cater for this specifically, I can quite easily restructure my source data on the fly to have 2 entries, joining them in code before pushing them to the table... So that's no big issue, but the column (and hopefully row) spanning is a necessity for me.

Any ideas?

add box shadow

box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0);

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.