-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'multi-click-selection-demo', | ||
template: ` | ||
<div> | ||
<h3>Multi Click Selection</h3> | ||
<div style='float:left;width:75%'> | ||
<div class="info"> | ||
<p>This demonstrates multi selection table, where any click event causes a selection.</p> | ||
</div> | ||
<ngx-datatable | ||
class="material" | ||
[rows]="rows" | ||
[columnMode]="'force'" | ||
[columns]="columns" | ||
[headerHeight]="50" | ||
[footerHeight]="50" | ||
[rowHeight]="'auto'" | ||
[limit]="5" | ||
[selected]="selected" | ||
[selectionType]="'multiClick'" | ||
(activate)="onActivate($event)" | ||
(select)='onSelect($event)'> | ||
</ngx-datatable> | ||
</div> | ||
<div class='selected-column'> | ||
<h4>Selections</h4> | ||
<ul> | ||
<li *ngFor='let sel of selected'> | ||
{{sel.name}} | ||
</li> | ||
<li *ngIf="!selected.length">No Selections</li> | ||
</ul> | ||
</div> | ||
</div> | ||
` | ||
}) | ||
export class MultiClickSelectionComponent { | ||
|
||
rows = []; | ||
|
||
selected = []; | ||
|
||
columns: any[] = [ | ||
{ prop: 'name'} , | ||
{ name: 'Company' }, | ||
{ name: 'Gender' } | ||
]; | ||
|
||
constructor() { | ||
this.fetch((data) => { | ||
this.rows = data; | ||
}); | ||
} | ||
|
||
fetch(cb) { | ||
const req = new XMLHttpRequest(); | ||
req.open('GET', `assets/data/company.json`); | ||
|
||
req.onload = () => { | ||
cb(JSON.parse(req.response)); | ||
}; | ||
|
||
req.send(); | ||
} | ||
|
||
onSelect({ selected }) { | ||
console.log('Select Event', selected, this.selected); | ||
|
||
this.selected.splice(0, this.selected.length); | ||
this.selected.push(...selected); | ||
} | ||
|
||
onActivate(event) { | ||
console.log('Activate Event', event); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
export enum SelectionType { | ||
single = 'single' as any, | ||
multi = 'multi' as any, | ||
multiClick = 'multiClick' as any, | ||
cell = 'cell' as any, | ||
checkbox = 'checkbox' as any | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters