### File

`src/table/table-item.class.ts`

### Index

###### Properties
colSpan data expandedData expandedTemplate rowSpan template

### Constructor

`constructor(rawData?: any)`
Defined in src/table/table-item.class.ts:68
Creates an instance of TableItem. Parameters :
Name | Type | Optional
rawData | `any` | Yes

### Properties

colSpan
`colSpan: `number``
Type : `number`
Default value : `1`
Defined in src/table/table-item.class.ts:68
The number of columns to span

data
`data: `any``
Type : `any`
Defined in src/table/table-item.class.ts:9
Data for the table item.

expandedData
`expandedData: `any``
Type : `any`
Defined in src/table/table-item.class.ts:16
Data for the expanded part of the row. You only need to set it for the first item in the row.

expandedTemplate
`expandedTemplate: `TemplateRef<any>``
Type : `TemplateRef<any>`
Defined in src/table/table-item.class.ts:58
Template for rendering `expandedData` You only need to set it for the first item in the row.

rowSpan
`rowSpan: `number``
Type : `number`
Default value : `1`
Defined in src/table/table-item.class.ts:63
The number of rows to span

template
`template: `TemplateRef<any>``
Type : `TemplateRef<any>`
Defined in src/table/table-item.class.ts:50
Used to display data in a desired way. If not provided, displays data as a simple string. Usage: In a component where you're using the table create a template like:
         * <ng-template #customItemTemplate let-data="data">
         *     <i><a [routerLink]="data.link">{{data.name}}</a></i>
         * </ng-template>
         *
where we assume your data contains `link` and `name`. `let-data="data"` is necessary for you to be able to access item's data in the template. Create `ViewChild` property with:
         * (at)ViewChild("customItemTemplate")
         * protected customItemTemplate: TemplateRef<any>;
         *
Set the template to the table item, for example:
         * this.model.data = [
         *     [new TableItem({data: {name: "Custom item", link: "/table"}, template: this.customItemTemplate})]
         * ];
         *

    import {
    	TemplateRef
    } from "@angular/core";

    export class TableItem {
    	/**
    	 * Data for the table item.
    	 */
    	data: any;

    	/**
    	 * Data for the expanded part of the row.
    	 *
    	 * You only need to set it for the first item in the row.
    	 */
    	expandedData: any;

    	/**
    	 * Used to display data in a desired way.
    	 *
    	 * If not provided, displays data as a simple string.
    	 *
    	 * Usage:
    	 *
    	 * In a component where you're using the table create a template like:
    	 *
    	 * ```html
    	 * <ng-template #customItemTemplate let-data="data">
    	 * 	<i><a [routerLink]="data.link">{{data.name}}</a></i>
    	 * </ng-template>
    	 * ```
    	 * where we assume your data contains `link` and `name`. `let-data="data"` is
    	 * necessary for you to be able to access item's data in the template.
    	 *
    	 * Create `ViewChild` property with:
    	 *
    	 * ```typescript
    	 * (at)ViewChild("customItemTemplate")
    	 * protected customItemTemplate: TemplateRef<any>;
    	 * ```
    	 *
    	 * Set the template to the table item, for example:
    	 *
    	 * ```typescript
    	 * this.model.data = [
    	 * 	[new TableItem({data: {name: "Custom item", link: "/table"}, template: this.customItemTemplate})]
    	 * ];
    	 * ```
    	 */
    	template: TemplateRef<any>;

    	/**
    	 * Template for rendering `expandedData`
    	 *
    	 * You only need to set it for the first item in the row.
    	 *
    	 */
    	expandedTemplate: TemplateRef<any>;

    	/**
    	 * The number of rows to span
    	 */
    	rowSpan = 1;

    	/**
    	 * The number of columns to span
    	 */
    	colSpan = 1;

    	/**
    	 * Creates an instance of TableItem.
    	 */
    	constructor(rawData?: any) {
    		// defaults so we dont leave things empty
    		const defaults = {
    			data: ""
    		};
    		// fill our object with provided props, and fallback to defaults
    		const data = Object.assign({}, defaults, rawData);
    		for (const property of Object.getOwnPropertyNames(data)) {
    			if (data.hasOwnProperty(property)) {
    				this[property] = data[property];
    			}
    		}
    	}
    }

# result-matching ""

# No results matching ""