1.1.4 • Published 6 years ago
ng-dalahoo-table v1.1.4
#Dalahoo Table
A simple and powerful Datatable for Angular based on Dalahoo Website Table with some additional features.

Key features
- Custom header cell template
 - Custom row cell template
 - Builtin sorting and searching
 - Custom column filtering
 
Prerequisites
- Angular version 5 or higher
 - FontAwesome
 
Installation
- Install ng-dalahoo-table with 
npm:npm install ng-dalahoo-table --save - Add 
DalahooTableModuletoimportsinsrc/app/app.module.ts:@NgModule({ imports: [ BrowserModule, DalahooTableModule ], declarations: [AppComponent], bootstrap: [AppComponent] }) export class AppModule { } - Add FontAwesome:
- Install fontawesome via npm:
npm install fontawesome --save - Add 
fontawesome scssfile tostylessection inpackage.jsonfile:"styles": [ "../node_modules/font-awesome/scss/font-awesome.scss" ] Add these two lines to
styles.scssfile:$fa-font-path: "../../../node_modules/font-awesome/fonts"; @import '~font-awesome/scss/font-awesome.scss';
 - Install fontawesome via npm:
 
Example
<dalahoo-table [items]="items" #table>
  <dalahoo-table-header>
    <dalahoo-table-header-cell field="group" flex="1">
      گروه
    </dalahoo-table-header-cell>
    <dalahoo-table-header-cell field="title" flex="1">
      عنوان
    </dalahoo-table-header-cell>
    <dalahoo-table-header-cell field="capacity" flex="0 0 100px" [isCenter]="true">
      ظرفیت
    </dalahoo-table-header-cell>
    <dalahoo-table-header-cell field="duration" flex="0 0 100px" [isCenter]="true">
      مدت
    </dalahoo-table-header-cell>
    <dalahoo-table-header-cell field="date" flex="0 0 120px" [isCenter]="true">
      تاریخ
    </dalahoo-table-header-cell>
  </dalahoo-table-header>
  <dalahoo-table-body>
    <dalahoo-table-row *ngFor="let item of table.displayItems">
      <dalahoo-table-row-cell >
        <span [highlightMatch]="item.group"></span>
      </dalahoo-table-row-cell>
      <dalahoo-table-row-cell >
        <span [highlightMatch]="item.title"></span>
      </dalahoo-table-row-cell>
      <dalahoo-table-row-cell >
        <span>{{item.capacity}}</span>
      </dalahoo-table-row-cell>
      <dalahoo-table-row-cell>
        <span [highlightMatch]="item.duration"></span>
      </dalahoo-table-row-cell>
      <dalahoo-table-row-cell>
        <span [highlightMatch]="item.date"></span>
      </dalahoo-table-row-cell>
    </dalahoo-table-row>
  </dalahoo-table-body>
</dalahoo-table>Filter functionality
- Create a component that implements Filterable interface
 - Add this component inside 
<dalahoo-table-header-cell>tag wrapped inside<dalahoo-table-header-cell-filter>tag 
@Component({
  selector: 'app-capacity-filter',
  templateUrl: './capacity-filter.component.html',
  styleUrls: ['./capacity-filter.component.scss']
})
export class CapacityFilterComponent implements Filterable<Item>, OnInit {
  @Output() filterChanged = new BehaviorSubject<boolean>(false);
  isAvailableChecked = true;
  isUnAvailableChecked = false;
  ngOnInit(): void {
    this.trigger();
  }
  trigger() {
    let isFiltered = !this.isAvailableChecked || !this.isUnAvailableChecked;
    this.filterChanged.next(isFiltered);
  }
  filter = (item: Item): boolean => {
    if(this.isAvailableChecked && this.isUnAvailableChecked) return true;
    if(this.isAvailableChecked) if(item.capacity == 'موجود') return true;
    if(this.isUnAvailableChecked) if(item.capacity == 'ناموجود') return true;
    return false;
  };
  availableCheckChanged(checked: boolean) {
    this.isAvailableChecked = checked;
    this.trigger();
  }
  unAvailableCheckChanged(checked: boolean) {
    this.isUnAvailableChecked = checked;
    this.trigger();
  }
}<dalahoo-table-header-cell field="capacity" flex="0 0 100px" [isCenter]="true">
    ظرفیت
    <dalahoo-table-header-cell-filter width="150px" height="70px" [filter]="capacityFilter">
      <app-capacity-filter #capacityFilter></app-capacity-filter>
    </dalahoo-table-header-cell-filter>
</dalahoo-table-header-cell>1.1.1
6 years ago
1.1.4
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago
0.0.20
6 years ago
0.0.21
6 years ago
0.0.22
6 years ago
0.0.23
6 years ago
0.0.24
6 years ago
0.0.25
6 years ago
0.0.18
6 years ago
0.0.19
6 years ago
0.0.26
6 years ago
0.0.17
6 years ago
0.0.16
6 years ago
0.0.15
6 years ago
0.0.14
6 years ago
0.0.13
6 years ago
0.0.12
6 years ago
0.0.10
6 years ago
0.0.11
6 years ago
0.0.9
6 years ago
0.0.8
6 years ago
0.0.7
6 years ago
0.0.3
6 years ago
0.0.5
6 years ago
0.0.4
6 years ago
0.0.6
6 years ago
0.0.2
6 years ago
0.0.1
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago