This repository was archived by the owner on Feb 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 490
Fixed columns extension documentation added #1761
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
6 changes: 6 additions & 0 deletions
6
demo/src/app/extensions/fixed-columns-extension.component.html
This file contains hidden or 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,6 @@ | ||
<ng-template #preview> | ||
<table datatable [dtOptions]="dtOptions" class="row-border hover"></table> | ||
</ng-template> | ||
<app-base-demo [pageTitle]="pageTitle" [mdIntro]="mdIntro" [mdInstall]="mdInstall" [mdHTML]="mdHTML" [mdTS]="mdTS" | ||
[template]="preview"> | ||
</app-base-demo> |
97 changes: 97 additions & 0 deletions
97
demo/src/app/extensions/fixed-columns-extension.component.ts
This file contains hidden or 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,97 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-fixed-columns-extension', | ||
templateUrl: 'fixed-columns-extension.component.html' | ||
}) | ||
export class FixedColumnsExtensionComponent implements OnInit { | ||
|
||
pageTitle = 'DataTables Fixed Columns extension'; | ||
mdIntro = 'assets/docs/extensions/fixedcolumns/intro.md'; | ||
mdInstall = 'assets/docs/extensions/fixedcolumns/installation.md'; | ||
mdHTML = 'assets/docs/extensions/fixedcolumns/source-html.md'; | ||
mdTS = 'assets/docs/extensions/fixedcolumns/source-ts.md'; | ||
|
||
// Must be declared as "any", not as "DataTables.Settings" | ||
dtOptions: any = {}; | ||
|
||
ngOnInit(): void { | ||
this.dtOptions = { | ||
ajax: 'data/data.json', | ||
columns: [{ | ||
title: 'ID', | ||
data: 'id' | ||
}, { | ||
title: 'First name', | ||
data: 'firstName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
} | ||
|
||
], | ||
// Make sure that scrollX is set to true for this to work! | ||
scrollX: true, | ||
fixedColumns: { | ||
left: 3, | ||
right: 0 | ||
}, | ||
}; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
demo/src/assets/docs/extensions/fixedcolumns/installation.md
This file contains hidden or 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,33 @@ | ||
##### NPM | ||
|
||
You need to install its dependencies: | ||
|
||
```bash | ||
# JS file | ||
npm install datatables.net-fixedcolumns --save | ||
# CSS file | ||
npm install datatables.net-fixedcolumns-bs4 --save | ||
``` | ||
|
||
##### angular.json | ||
|
||
Add the dependencies in the scripts and styles attributes: | ||
|
||
```json | ||
{ | ||
"projects": { | ||
"your-app-name": { | ||
"architect": { | ||
"build": { | ||
"options": { | ||
"styles": [ | ||
... | ||
"node_modules/datatables.net-fixedcolumns-bs4/css/fixedColumns.bootstrap4.css" | ||
], | ||
"scripts": [ | ||
... | ||
"node_modules/datatables.net-fixedcolumns/js/dataTables.fixedColumns.js" | ||
], | ||
... | ||
} | ||
``` |
This file contains hidden or 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,3 @@ | ||
You can use the [Fixed Columns Extension](https://datatables.net/extensions/fixedcolumns/) with angular-datatables.<br> | ||
This extension comes handy when you have a large number of columns and want to freeze | ||
certain columns on either side while scrolling along X axis. |
This file contains hidden or 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,3 @@ | ||
```html | ||
<table datatable [dtOptions]="dtOptions" class="row-border hover"></table> | ||
``` |
This file contains hidden or 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,93 @@ | ||
```typescript | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-select-extension', | ||
templateUrl: 'select-extension.component.html' | ||
}) | ||
export class SelectExtensionComponent implements OnInit { | ||
|
||
// Must be declared as "any", not as "DataTables.Settings" | ||
dtOptions: any = {}; | ||
|
||
ngOnInit(): void { | ||
this.dtOptions = { | ||
ajax: 'data/data.json', | ||
columns: [{ | ||
title: 'ID', | ||
data: 'id' | ||
}, { | ||
title: 'First name', | ||
data: 'firstName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, | ||
{ | ||
title: 'Last name', | ||
data: 'lastName' | ||
}, { | ||
title: 'Last name', | ||
data: 'lastName' | ||
} | ||
|
||
], | ||
// Make sure that scrollX is set to true for this to work! | ||
scrollX: true, | ||
fixedColumns: { | ||
left: 3, | ||
right: 0 | ||
}, | ||
}; | ||
} | ||
} | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.