ng-editable-table is a dynamic angular table, you can add, edit or delete rows without any style sheet.
inline editable table angular 8, angularmaterial editable table, angularmaterial table with edit and delete button, angularmaterial table editable row
How to make use of it:
Installation:
npm install ng-editable-table --save
1. You will need to add the EditableTableModule to your application module.
import { EditableTableModule } from 'ng-editable-table/editable-table/editable-table.module'; @NgModule({ imports: [ EditableTableModule ], declarations: [ AppComponent ], providers: [], bootstrap: [AppComponent] export class AppModule {} })
2. You need to create an array of headers and rows to use the ng-editable-table directive.
@Component({ selector: 'app', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { tableHeaders = ['Header 1', 'Header 2', 'Header 3']; tableRows = [ ['Cell', 'Cell', 'Cell'], ['Cell', 'Cell', 'Cell'], ['Cell', 'Cell', 'Cell'] ]; constructor() {} ... }
3. Finally, add this directive to your html:
<nv-editable-table [table-headers]="tableHeaders" [table-rows]="tableRows" ></nv-editable-table>
Directive Options
You can customize the table options by the nv-editable-table
the directive, the available options are:
Option | Value | Description |
---|---|---|
table-headers | String Array | An array of strings with headers name |
table-rows | Array of any [] | An array of any[] with the content of the row |
table-rows-with-id | Array of any [] | An array of any[] with the content of the row, using the first value like row ID, useful to identify objects and rows |
can-delete-rows | true/false | Enable or disable the delete rows button |
can-edit-rows | true/false | Enable or disable the edit rows button |
can-add-rows | true/false | Enable or disable add rows button |
add-button-label | String | String label for add button |
edit-button-label | String | String label for the edit button |
save-button-label | String | String label for save button |
cancel-button-label | String | String label for cancel button |
delete-button-label | String | String label for the delete button |
add-icon | String | Icon class for add button |
edit-icon | String | Icon class for the edit button |
save-icon | String | Icon class for save button |
delete-icon | String | Icon class for the delete button |
add-button-class | String | Add button class |
edit-button-class | String | Edit/save button class |
delete-button-class | String | Delete button class |
tr-class | String | Table row class |
td-class | String | Table cell class |
buttons-td-class | String | Buttons column class |
You can catch the edit and delete events using the directive outputs:
Option | Description |
---|---|
onSave | Return an event when the button save is clicked |
onRemove | Returns an event when the button remove is clicked |
angular editable table component, ng-editable-table Plugin/Github, angular editable table row, angular material inline editable table
See Demo And Download
Official Website(BennyFranco): Click Here
This superior jQuery/javascript plugin is developed by BennyFranco. For extra advanced usage, please go to the official website.
Be First to Comment