### Install Dependencies for Development
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/introduction/installing.md
Install project dependencies required for local development and running demos. This is typically done before starting the development server.
```bash
npm i
```
--------------------------------
### Development Server
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/README.md
Run 'yarn start' to serve the demo application at http://localhost:4200/. The app will automatically reload upon changes to source files.
```bash
yarn start
```
--------------------------------
### Start Development Server
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/introduction/installing.md
Start the local development server to run the ngx-datatable demos. Access the demos by browsing to the specified localhost URL.
```bash
npm start
```
--------------------------------
### Install ngx-datatable
Source: https://github.com/swimlane/ngx-datatable/blob/master/README.md
Install the ngx-datatable package using npm. This command saves the package as a dependency in your project.
```bash
npm i @swimlane/ngx-datatable --save
```
--------------------------------
### Row Detail Template Example
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/detail/inputs.md
Defines the template to be used for displaying detailed information in a row. The `let-row="row"` syntax makes the row data available within the template.
```html
Address
{{row.address.city}}, {{row.address.state}}
```
--------------------------------
### Custom Sort Comparator Example
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/column/inputs.md
Implement a custom sort comparator function to define specific sorting logic for a column. The function receives values, rows, and sort direction, returning -1, 0, or 1.
```javascript
(valueA, valueB, rowA, rowB, sortDirection) => -1|0|1
```
--------------------------------
### Publishing the Project
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/README.md
Execute 'yarn publish' to publish the project. This command is typically used after building and packaging the project during a release.
```bash
yarn publish
```
--------------------------------
### Package ngx-datatable
Source: https://github.com/swimlane/ngx-datatable/blob/master/README.md
Build the package for release. This command is part of the release process to prepare the library for publishing.
```bash
yarn package
```
--------------------------------
### Build ngx-datatable
Source: https://github.com/swimlane/ngx-datatable/blob/master/README.md
Build the project artifacts, which will be stored in the dist/ directory. This command is used for development and deployment.
```bash
yarn build
```
--------------------------------
### Run Tests for ngx-datatable
Source: https://github.com/swimlane/ngx-datatable/blob/master/README.md
Execute the linter, prettier check, unit, and end-to-end tests. This command ensures code quality and functionality.
```bash
yarn test
```
--------------------------------
### Server-Side DimensionsHelper Implementation
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/universal/server-side-rendering.md
Provides dimensions for the grid based on client hints from request cookies, falling back to default values if hints are not available. This service is essential for rendering grids correctly on the server.
```typescript
import { ScrollbarHelper } from '@swimlane/ngx-datatable';
import { Injectable, Inject } from '@angular/core';
import { Request } from 'express';
import { REQUEST } from '@nguniversal/express-engine/tokens';
import { DimensionsHelper } from '@swimlane/ngx-datatable';
@Injectable()
export class ServerDimensionsHelper extends DimensionsHelper {
constructor(@Inject(REQUEST) private request: Request) {
super();
}
getDimensions(element: Element): ClientRect {
const width = parseInt(this.request.cookies['CH-DW'], 10) || 1000;
const height = parseInt(this.request.cookies['CH-DH'], 10) || 800;
const adjustedWidth = width;
const adjustedHeight = height;
return {
height: adjustedHeight,
bottom: 0,
top: 0,
width: adjustedWidth,
left: 0,
right: 0
};
}
}
```
--------------------------------
### `virtualization` Input
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/inputs.md
Controls whether virtual scrolling is enabled for the data table. When enabled, only the rows currently visible in the viewport are rendered, improving performance for large datasets.
```APIDOC
## `virtualization` Input
### Description
Use virtual scrolling for improved performance with large datasets.
### Default Value
`true`
### Usage
Set to `true` to enable virtual scrolling, or `false` to disable it.
```
--------------------------------
### activate
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/outputs.md
Emitted when a cell or row is focused via keyboard or mouse click. It provides details about the interaction event, the row, column, value, and the DOM elements involved.
```APIDOC
## activate
### Description
A cell or row was focused via keyboard or mouse click.
### Event Payload
```json
{
"type": "keydown" | "click" | "dblclick",
"event": "any",
"row": "any",
"column": "any",
"value": "any",
"cellElement": "HTMLElement",
"rowElement": "HTMLElement"
}
```
```
--------------------------------
### cssClasses
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/inputs.md
Allows customization of CSS classes for icons used in sorting and pagination.
```APIDOC
## `cssClasses`
### Description
Custom CSS classes that can be defined to override the icons classes for up/down in sorts and previous/next in the pager.
### Parameters
#### Query Parameters
- **cssClasses** (Object) - Optional - An object containing custom CSS class names for various table elements.
- **sortAscending** (string) - Optional - CSS class for ascending sort icon.
- **sortDescending** (string) - Optional - CSS class for descending sort icon.
- **pagerLeftArrow** (string) - Optional - CSS class for the left pager arrow.
- **pagerRightArrow** (string) - Optional - CSS class for the right pager arrow.
- **pagerPrevious** (string) - Optional - CSS class for the previous pager button.
- **pagerNext** (string) - Optional - CSS class for the next pager button.
```
--------------------------------
### columnMode
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/inputs.md
Specifies the method used for setting column widths. It can be 'standard', 'flex', or 'force'.
```APIDOC
## `columnMode`
### Description
Method used for setting column widths.
### Parameters
#### Query Parameters
- **columnMode** (string) - Required - The column width distribution mode. Possible values: `standard`, `flex`, `force`.
```
--------------------------------
### CSS Icon Mapping
Source: https://github.com/swimlane/ngx-datatable/blob/master/src/assets/icons-reference.html
Lists CSS classes for directly applying icons. Each icon has a base class and a specific class for its representation.
```html
```
--------------------------------
### page
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/outputs.md
Emitted when the table is paginated, either through the pager interface or by scrolling the body. It includes information about the total count, page size, limit, and offset.
```APIDOC
## page
### Description
The table was paged either triggered by the pager or the body scroll.
### Event Payload
```json
{
"count": "number",
"pageSize": "number",
"limit": "number",
"offset": "number"
}
```
```
--------------------------------
### expandAllRows()
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/detail/methods.md
Expands all row details. This method is useful for showing all details at once when using row detail templates.
```APIDOC
## expandAllRows()
### Description
Expand all row details when using row detail templates.
### Method
`expandAllRows()`
### Endpoint
N/A (Method call within the component/service)
### Parameters
None
### Request Example
```javascript
this.table.expandAllRows();
```
### Response
N/A (Method modifies component state)
```
--------------------------------
### columns
Source: https://github.com/swimlane/ngx-datatable/blob/master/docs/api/table/inputs.md
Defines the array of columns to be displayed in the table.
```APIDOC
## `columns`
### Description
Array of columns to display in the table.
### Parameters
#### Query Parameters
- **columns** (Array