mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-02-27 02:14:06 +01:00
feat(smarttable): table setup
This commit is contained in:
parent
78602432e4
commit
5aea53a1aa
4 changed files with 102 additions and 137 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import {Component, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {BasicTablesService} from './basicTables.service';
|
||||
import {BaCard} from '../../../../theme/components';
|
||||
|
||||
import {NG2_SMART_TABLE_DIRECTIVES, LocalDataSource} from 'ng2-smart-table';
|
||||
import { SmartTablesService } from './smartTables.service';
|
||||
|
||||
@Component({
|
||||
selector: 'basic-tables',
|
||||
|
|
@ -11,24 +11,57 @@ import {NG2_SMART_TABLE_DIRECTIVES, LocalDataSource} from 'ng2-smart-table';
|
|||
directives: [BaCard, NG2_SMART_TABLE_DIRECTIVES],
|
||||
styles: [require('./smartTables.scss')],
|
||||
template: require('./smartTables.html'),
|
||||
providers: [BasicTablesService]
|
||||
providers: [SmartTablesService]
|
||||
})
|
||||
export class SmartTables {
|
||||
|
||||
settings = {
|
||||
attr: {
|
||||
class: 'table'
|
||||
add: {
|
||||
addButtonContent: '<i class="ion-ios-plus-outline"></i>',
|
||||
createButtonContent: '<i class="ion-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="ion-close"></i>',
|
||||
},
|
||||
edit: {
|
||||
editButtonContent: '<i class="ion-edit"></i>',
|
||||
saveButtonContent: '<i class="ion-checkmark"></i>',
|
||||
cancelButtonContent: '<i class="ion-close"></i>',
|
||||
},
|
||||
delete: {
|
||||
deleteButtonContent: '<i class="ion-trash-a"></i>',
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: 'ID',
|
||||
type: 'number'
|
||||
},
|
||||
name: {
|
||||
title: 'Product Name',
|
||||
firstName: {
|
||||
title: 'First Name',
|
||||
type: 'string'
|
||||
},
|
||||
lastName: {
|
||||
title: 'Last Name',
|
||||
type: 'string'
|
||||
},
|
||||
username: {
|
||||
title: 'Username',
|
||||
type: 'string'
|
||||
},
|
||||
email: {
|
||||
title: 'E-mail',
|
||||
type: 'string'
|
||||
},
|
||||
age: {
|
||||
title: 'Age',
|
||||
type: 'number'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
source: LocalDataSource = new LocalDataSource();
|
||||
|
||||
constructor(protected service: SmartTablesService) {
|
||||
this.service.getData().then((data) => {
|
||||
this.source.load(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue