Gantt component allows you to display and edit complex data.
smart-gantt
Sets or gets a list of column groups that constitute the column header hierarchy. Note: when column header hierarchy is created, column resizing and auto-sizing is not supported.
Set the columnGroups property.
<smart-gantt [columnGroups]="[{ label: 'User Info', name: 'userInfo' }, { label: 'Product Info', name: 'productInfo' }]"></smart-gantt>
Set the columnGroups property by using the component's instance.
this.gantt.columnGroups = [{ label: 'User Info', name: 'userInfo' }, { label: 'Product Info', name: 'productInfo', parentGroup: 'purchaseInfo' }, { label: 'Purchase Info', name: 'purchaseInfo' }];
Get the columnGroups property.
let columnGroups = this.gantt.columnGroups;
Sets or gets the min width of columns when columnSizeMode is 'auto' or when resizing columns. This property has no effect on columns with programmatically set width.
Set the columnMinWidth property.
<smart-gantt [columnMinWidth]="100"></smart-gantt>
Set the columnMinWidth property by using the component's instance.
this.gantt.columnMinWidth = 20px;
Get the columnMinWidth property.
let columnMinWidth = this.gantt.columnMinWidth;
Sets or gets whether the reordering of columns is enabled.
Set the columnReorder property.
<smart-gantt [columnReorder]="true"></smart-gantt>
Set the columnReorder property by using the component's instance.
this.gantt.columnReorder = false;
Get the columnReorder property.
let columnReorder = this.gantt.columnReorder;
Sets or gets whether the resizing of columns is enabled. Note: column sizes continue to adhere to the behavior of the standard HTML table element's table-layout: fixed, upon which smart-table is based.
Set the columnResize property.
<smart-gantt [columnResize]="true"></smart-gantt>
Set the columnResize property by using the component's instance.
this.gantt.columnResize = false;
Get the columnResize property.
let columnResize = this.gantt.columnResize;
Sets or gets whether when resizing a column, a feedback showing the new column width in px will be displayed.
Set the columnResizeFeedback property.
<smart-gantt [columnResizeFeedback]="true"></smart-gantt>
Set the columnResizeFeedback property by using the component's instance.
this.gantt.columnResizeFeedback = false;
Get the columnResizeFeedback property.
let columnResizeFeedback = this.gantt.columnResizeFeedback;
Describes the columns properties.
Set the columns property.
<smart-gantt [columns]="[{ label: 'In progress', dataField: 'inProgress' }, { label: 'Testing', dataField: 'testing' }, { label: 'Done', dataField: 'done' }]"></smart-gantt>
Set the columns property by using the component's instance.
this.gantt.columns = [{ label: 'In progress', dataField: 'inProgress' }, { label: 'Testing', dataField: 'testing', orientation: 'horizontal', columns: [{ label: 'Manual testing', dataField: 'manualTesting', selected: true, columns: [{ label: 'Desktop devices', dataField: 'desktop' }, { label: 'Mobile devices', dataField: 'mobile', selected: true }] }, { label: 'Unit testing', dataField: 'unitTesting' }] }];
Get the columns property.
let columns = this.gantt.columns;
Sets or gets the column sizing behavior. In 'auto' mode Columns are automatically sized based on their content and the value of the columnMinWidth property, unless there is not enough space in the Table, in which case ellipses are shown. User-set static column width is still respected. In 'default' mode Columns are sized according to the rules of the standard HTML table element's table-layout: fixed. Custom width can also be applied to columns in this case by setting the column width property.
Set the columnSizeMode property.
<smart-gantt [columnSizeMode]="'auto'"></smart-gantt>
Set the columnSizeMode property by using the component's instance.
this.gantt.columnSizeMode = 'default';
Get the columnSizeMode property.
let columnSizeMode = this.gantt.columnSizeMode;
When binding the dataSource property directly to an array (as opposed to an instance of Smart.DataAdapter), sets or gets the name of the data field in the source array to bind row ids to.
Set the dataRowId property.
<smart-gantt [dataRowId]="'ID'"></smart-gantt>
Set the dataRowId property by using the component's instance.
this.gantt.dataRowId = 'uid';
Get the dataRowId property.
let dataRowId = this.gantt.dataRowId;
Determines the data source of the table component. The data source of the Table can be a regular Array or a DataAdapter instance. You can read more about the dataAdapter here - https://www.htmlelements.com/docs/data-adapter/.
Sets the grid's data source settings when the dataSource property is set to an Array or URL.
A callback function that can be used to transform the initial dataSource records. If implemented, it is called once for each record (which is passed as an argument).
Set the dataTransform property.
<smart-gantt [dataTransform]="dataTransformCallback"></smart-gantt>
Set the dataTransform property by using the component's instance.
this.gantt.dataTransform = dataTransform;
Get the dataTransform property.
let dataTransform = this.gantt.dataTransform;
Disables the interaction with the element.
Set the disabled property.
<smart-gantt [disabled]="true"></smart-gantt>
Set the disabled property by using the component's instance.
this.gantt.disabled = false;
Get the disabled property.
let disabled = this.gantt.disabled;
Sets or gets whether the Table can be filtered. By default, the Table can be filtered by all string and numeric columns through a filter input in the header.
Set the filtering property.
<smart-gantt [filtering]="true"></smart-gantt>
Set the filtering property by using the component's instance.
this.gantt.filtering = false;
Get the filtering property.
let filtering = this.gantt.filtering;
Sets or gets whether the Table can be filtered via a filter row.
Set the filterRow property.
<smart-gantt [filterRow]="true"></smart-gantt>
Set the filterRow property by using the component's instance.
this.gantt.filterRow = false;
Get the filterRow property.
let filterRow = this.gantt.filterRow;
Sets or gets the id of an HTML template element to be applied as a custom filter template.
Set the filterTemplate property.
<smart-gantt [filterTemplate]="'customFilterTemplate'"></smart-gantt>
Set the filterTemplate property by using the component's instance.
this.gantt.filterTemplate = 'myFilterTemplate';
Get the filterTemplate property.
let filterTemplate = this.gantt.filterTemplate;
Sets or gets the id of an HTML template element to be applied as footer row(s).
Set the footerRow property.
<smart-gantt [footerRow]="'customFooterRow'"></smart-gantt>
Set the footerRow property by using the component's instance.
this.gantt.footerRow = 'myFooterRow';
Get the footerRow property.
let footerRow = this.gantt.footerRow;
Sets or gets whether the Table's footer is sticky/frozen.
Set the freezeFooter property.
<smart-gantt [freezeFooter]="true"></smart-gantt>
Set the freezeFooter property by using the component's instance.
this.gantt.freezeFooter = false;
Get the freezeFooter property.
let freezeFooter = this.gantt.freezeFooter;
Sets or gets whether the Table's column header is sticky/frozen.
Set the freezeHeader property.
<smart-gantt [freezeHeader]="true"></smart-gantt>
Set the freezeHeader property by using the component's instance.
this.gantt.freezeHeader = false;
Get the freezeHeader property.
let freezeHeader = this.gantt.freezeHeader;
Sets or gets the id of an HTML template element to be applied as additional column header(s).
Set the headerRow property.
<smart-gantt [headerRow]="'customHeaderRowTemplate'"></smart-gantt>
Set the headerRow property by using the component's instance.
this.gantt.headerRow = 'myHeaderRow';
Get the headerRow property.
let headerRow = this.gantt.headerRow;
Sets or gets whether navigation with the keyboard is enabled in the Table.
Set the keyboardNavigation property.
<smart-gantt [keyboardNavigation]="true"></smart-gantt>
Set the keyboardNavigation property by using the component's instance.
this.gantt.keyboardNavigation = false;
Get the keyboardNavigation property.
let keyboardNavigation = this.gantt.keyboardNavigation;
Sets or gets the language. Used in conjunction with the property messages.
Set the locale property.
<smart-gantt [locale]="'de'"></smart-gantt>
Set the locale property by using the component's instance.
this.gantt.locale = 'fr';
Get the locale property.
let locale = this.gantt.locale;
Sets or gets an object specifying strings used in the element that can be localized. Used in conjunction with the property locale.
Set the messages property.
<smart-gantt [messages]="{"he":{"add":"הוסף תנאי","all":"כל העמודות","apply":"להגיש מועמדות","between":"בֵּין","cancel":"לְבַטֵל","clearFilter":"נקה את המסנן","close":"סגור","column":"טור:","condition":"מַצָב:","conditionalFormatting":"עיצוב מותנה","CONTAINS":"מכיל","CONTAINS_CASE_SENSITIVE":"מכיל (רגיש רישיות)","DOES_NOT_CONTAIN":"לא מכיל","DOES_NOT_CONTAIN_CASE_SENSITIVE":"לא מכיל (רגיש רישיות)","EMPTY":"ריק","ENDS_WITH":"נגמר עם","ENDS_WITH_CASE_SENSITIVE":"מסתיים ב (רגיש רישיות)","EQUAL":"שווה","EQUAL_CASE_SENSITIVE":"שווה (רגיש לרישיות","filterCondition":"מצב סינון","filterPlaceholder":"לְסַנֵן","firstButton":"ראשון","fontFamily":"משפחת גופן:","fontSize":"גודל גופן:","format":"פוּרמָט:","formatColumn":"עמוד עמוד","GREATER_THAN":"גדול מ","GREATER_THAN_OR_EQUAL":"גדול או שווה","greaterThan":"גדול מ","highlight":"שִׂיא","invalidValue":"ערך לא תקין","itemsPerPage":"פריטים לעמוד:","lastButton":"אחרון","LESS_THAN":"פחות מ","LESS_THAN_OR_EQUAL":"פחות מ או שווה","lessThan":"פחות מ","nextButton":"הַבָּא","NOT_EMPTY":"לא ריק","NOT_EQUAL":"לא שווה","NOT_NULL":"לא ריק","notEqual":"לא שווה ל","NULL":"null","ok":"בסדר","previousButton":"קודם","remove":"הסר את המצב","secondValue":"ערך שני:","STARTS_WITH":"מתחיל עם","STARTS_WITH_CASE_SENSITIVE":"מתחיל עם (רגיש רישיות)","summaryPrefix":"שֶׁל","text":"טֶקסט","value":"ערך:","with":"עם"}}"></smart-gantt>
Set the messages property by using the component's instance.
this.gantt.messages = {"en":{"add":"Add condition","all":"All columns","apply":"Apply","between":"Between","cancel":"Cancel","clearFilter":"Clear filter","close":"Close","column":"Column:","condition":"Condition:","conditionalFormatting":"Conditional Formatting","CONTAINS":"contains","CONTAINS_CASE_SENSITIVE":"contains (case sensitive)","DOES_NOT_CONTAIN":"does not contain","DOES_NOT_CONTAIN_CASE_SENSITIVE":"does not contain (case sensitive)","EMPTY":"empty","ENDS_WITH":"ends with","ENDS_WITH_CASE_SENSITIVE":"ends with (case sensitive)","EQUAL":"equal","EQUAL_CASE_SENSITIVE":"equal (case sensitive)","filterCondition":"Filter condition","filterPlaceholder":"Filter","firstButton":"First","fontFamily":"Font family:","fontSize":"Font size:","format":"Format:","formatColumn":"Format Column","GREATER_THAN":"greater than","GREATER_THAN_OR_EQUAL":"greater than or equal","greaterThan":"Greater Than","highlight":"Highlight","invalidValue":"Invalid value","itemsPerPage":"Items per page:","lastButton":"Last","LESS_THAN":"less than","LESS_THAN_OR_EQUAL":"less than or equal","lessThan":"Less Than","nextButton":"Next","NOT_EMPTY":"not empty","NOT_EQUAL":"not equal","NOT_NULL":"not null","notEqual":"Not Equal To","NULL":"null","ok":"OK","previousButton":"Previous","remove":"Remove condition","secondValue":"Second value:","STARTS_WITH":"starts with","STARTS_WITH_CASE_SENSITIVE":"starts with (case sensitive)","summaryPrefix":"of","text":"Text","value":"Value:","with":"with"}};
Get the messages property.
let messages = this.gantt.messages;
A callback function executed each time a Table cell is rendered.
Set the onCellRender property.
<smart-gantt [onCellRender]="onCellRender"></smart-gantt>
Set the onCellRender property by using the component's instance.
this.gantt.onCellRender = onCellRenderCallback;
Get the onCellRender property.
let onCellRender = this.gantt.onCellRender;
A callback function executed each time a Table column header cell is rendered.
Set the onColumnRender property.
<smart-gantt [onColumnRender]="onColumnRender"></smart-gantt>
Set the onColumnRender property by using the component's instance.
this.gantt.onColumnRender = onColumnRenderCallback;
Get the onColumnRender property.
let onColumnRender = this.gantt.onColumnRender;
A callback function executed when the Table is being initialized.
Set the onInit property.
<smart-gantt [onInit]="onInit"></smart-gantt>
Set the onInit property by using the component's instance.
this.gantt.onInit = onInitCallback;
Get the onInit property.
let onInit = this.gantt.onInit;
Sets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
Set the rightToLeft property.
<smart-gantt [rightToLeft]="true"></smart-gantt>
Set the rightToLeft property by using the component's instance.
this.gantt.rightToLeft = true;
Get the rightToLeft property.
let rightToLeft = this.gantt.rightToLeft;
Sets or gets a string template to be applied as row detail template. Each cell value in the master row can be placed in the detail row by specifying the cell's data field in double curly brackets (e.g. {{price}}. The details can then be displayed by expanding the row by clicking it.
Set the rowDetailTemplate property.
<smart-gantt [rowDetailTemplate]="'{{number}}'"></smart-gantt>
Set the rowDetailTemplate property by using the component's instance.
this.gantt.rowDetailTemplate = '{{name}}';
Get the rowDetailTemplate property.
let rowDetailTemplate = this.gantt.rowDetailTemplate;
Sets or gets an array of the Table's selected row's ids.
Set the selected property.
<smart-gantt [selected]="[5, 8, 9]"></smart-gantt>
Set the selected property by using the component's instance.
this.gantt.selected = [0];
Get the selected property.
let selected = this.gantt.selected;
Sets or gets whether row selection (via checkboxes) is enabled.
Set the selection property.
<smart-gantt [selection]="true"></smart-gantt>
Set the selection property by using the component's instance.
this.gantt.selection = false;
Get the selection property.
let selection = this.gantt.selection;
Sets or gets the selection mode. Only applicable when selection is enabled.
Set the selectionMode property.
<smart-gantt [selectionMode]="'extended'"></smart-gantt>
Set the selectionMode property by using the component's instance.
this.gantt.selectionMode = 'many';
Get the selectionMode property.
let selectionMode = this.gantt.selectionMode;
A callback function executed when a column is sorted that can be used to override the default sorting behavior. The function is passed four parameters:
Set the sort property.
<smart-gantt [sort]="sort"></smart-gantt>
Set the sort property by using the component's instance.
this.gantt.sort = sortCallback;
Get the sort property.
let sort = this.gantt.sort;
Determines the sorting mode of the Table.
Set the sortMode property.
<smart-gantt [sortMode]="'one'"></smart-gantt>
Set the sortMode property by using the component's instance.
this.gantt.sortMode = 'many';
Get the sortMode property.
let sortMode = this.gantt.sortMode;
Sets or gets whether when hovering a cell with truncated content, a tooltip with the full content will be shown.
Set the tooltip property.
<smart-gantt [tooltip]="true"></smart-gantt>
Set the tooltip property by using the component's instance.
this.gantt.tooltip = false;
Get the tooltip property.
let tooltip = this.gantt.tooltip;
This event is triggered when a cell edit operation has been initiated.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of cellBeginEdit event.
<smart-gantt (cellBeginEdit)="onCellBeginEdit($event)"></smart-gantt>
onCellBeginEdit($event) { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value; // event handling code goes here. }
this.gantt.addEventListener('cellBeginEdit', (event: CustomEvent) => { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value; // event handling code goes here. })
This event is triggered when a cell has been clicked.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of cellClick event.
<smart-gantt (cellClick)="onCellClick($event)"></smart-gantt>
onCellClick($event) { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value, originalEvent = detail.originalEvent; // event handling code goes here. }
this.gantt.addEventListener('cellClick', (event: CustomEvent) => { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value, originalEvent = detail.originalEvent; // event handling code goes here. })
This event is triggered when a cell has been edited.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of cellEndEdit event.
<smart-gantt (cellEndEdit)="onCellEndEdit($event)"></smart-gantt>
onCellEndEdit($event) { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value; // event handling code goes here. }
this.gantt.addEventListener('cellEndEdit', (event: CustomEvent) => { const detail = event.detail, id = detail.id, dataField = detail.dataField, row = detail.row, value = detail.value; // event handling code goes here. })
This event is triggered when the selection is changed. Within the event handler you can get the selection by using the 'getSelection' method.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of change event.
<smart-gantt (change)="onChange($event)"></smart-gantt>
onChange($event) { const detail = event.detail, type = detail.type; // event handling code goes here. }
this.gantt.addEventListener('change', (event: CustomEvent) => { const detail = event.detail, type = detail.type; // event handling code goes here. })
This event is triggered when a row has been collapsed.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of collapse event.
<smart-gantt (collapse)="onCollapse($event)"></smart-gantt>
onCollapse($event) { const detail = event.detail, id = detail.id, record = detail.record; // event handling code goes here. }
this.gantt.addEventListener('collapse', (event: CustomEvent) => { const detail = event.detail, id = detail.id, record = detail.record; // event handling code goes here. })
This event is triggered when a row has been expanded.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of expand event.
<smart-gantt (expand)="onExpand($event)"></smart-gantt>
onExpand($event) { const detail = event.detail, id = detail.id, record = detail.record; // event handling code goes here. }
this.gantt.addEventListener('expand', (event: CustomEvent) => { const detail = event.detail, id = detail.id, record = detail.record; // event handling code goes here. })
This event is triggered when a column header cell has been clicked.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of columnClick event.
<smart-gantt (columnClick)="onColumnClick($event)"></smart-gantt>
onColumnClick($event) { const detail = event.detail, dataField = detail.dataField; // event handling code goes here. }
this.gantt.addEventListener('columnClick', (event: CustomEvent) => { const detail = event.detail, dataField = detail.dataField; // event handling code goes here. })
This event is triggered when a column has been resized via dragging or double-click.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of columnResize event.
<smart-gantt (columnResize)="onColumnResize($event)"></smart-gantt>
onColumnResize($event) { const detail = event.detail, dataField = detail.dataField, headerCellElement = detail.headerCellElement, width = detail.width; // event handling code goes here. }
this.gantt.addEventListener('columnResize', (event: CustomEvent) => { const detail = event.detail, dataField = detail.dataField, headerCellElement = detail.headerCellElement, width = detail.width; // event handling code goes here. })
This event is triggered when a filtering-related action is made.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of filter event.
<smart-gantt (filter)="onFilter($event)"></smart-gantt>
onFilter($event) { const detail = event.detail, action = detail.action, filters = detail.filters; // event handling code goes here. }
this.gantt.addEventListener('filter', (event: CustomEvent) => { const detail = event.detail, action = detail.action, filters = detail.filters; // event handling code goes here. })
This event is triggered when a grouping-related action is made.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of group event.
<smart-gantt (group)="onGroup($event)"></smart-gantt>
onGroup($event) { const detail = event.detail, action = detail.action, dataField = detail.dataField, label = detail.label, path = detail.path; // event handling code goes here. }
this.gantt.addEventListener('group', (event: CustomEvent) => { const detail = event.detail, action = detail.action, dataField = detail.dataField, label = detail.label, path = detail.path; // event handling code goes here. })
This event is triggered when a row edit operation has been initiated (only when editMode is 'row').
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of rowBeginEdit event.
<smart-gantt (rowBeginEdit)="onRowBeginEdit($event)"></smart-gantt>
onRowBeginEdit($event) { const detail = event.detail, id = detail.id, row = detail.row; // event handling code goes here. }
this.gantt.addEventListener('rowBeginEdit', (event: CustomEvent) => { const detail = event.detail, id = detail.id, row = detail.row; // event handling code goes here. })
This event is triggered when a row has been edited (only when editMode is 'row').
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of rowEndEdit event.
<smart-gantt (rowEndEdit)="onRowEndEdit($event)"></smart-gantt>
onRowEndEdit($event) { const detail = event.detail, id = detail.id, row = detail.row; // event handling code goes here. }
this.gantt.addEventListener('rowEndEdit', (event: CustomEvent) => { const detail = event.detail, id = detail.id, row = detail.row; // event handling code goes here. })
This event is triggered when a column header cell has been clicked or sorting is applied programmatically using the Table API.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of sort event.
<smart-gantt (sort)="onSort($event)"></smart-gantt>
onSort($event) { const detail = event.detail, columns = detail.columns, sortDataFields = detail.sortDataFields, sortOrders = detail.sortOrders, sortDataTypes = detail.sortDataTypes, type = detail.type; // event handling code goes here. }
this.gantt.addEventListener('sort', (event: CustomEvent) => { const detail = event.detail, columns = detail.columns, sortDataFields = detail.sortDataFields, sortOrders = detail.sortOrders, sortDataTypes = detail.sortDataTypes, type = detail.type; // event handling code goes here. })
This event is triggered when a ticket drag starts.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of ticketDragStart event.
<smart-gantt (ticketDragStart)="onTicketDragStart($event)"></smart-gantt>
onTicketDragStart($event) { const detail = event.detail, data = detail.data, id = detail.id; // event handling code goes here. }
this.gantt.addEventListener('ticketDragStart', (event: CustomEvent) => { const detail = event.detail, data = detail.data, id = detail.id; // event handling code goes here. })
This event is triggered when a ticket drag is canceled. This can happen when the user presses the 'Escape' key.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of ticketDragCancel event.
<smart-gantt (ticketDragCancel)="onTicketDragCancel($event)"></smart-gantt>
onTicketDragCancel($event) { const detail = event.detail, data = detail.data; // event handling code goes here. }
this.gantt.addEventListener('ticketDragCancel', (event: CustomEvent) => { const detail = event.detail, data = detail.data; // event handling code goes here. })
This event is triggered when a ticket drag ends.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of ticketDragEnd event.
<smart-gantt (ticketDragEnd)="onTicketDragEnd($event)"></smart-gantt>
onTicketDragEnd($event) { const detail = event.detail, data = detail.data; // event handling code goes here. }
this.gantt.addEventListener('ticketDragEnd', (event: CustomEvent) => { const detail = event.detail, data = detail.data; // event handling code goes here. })
This event is triggered when a ticket is reordered.
Returns true if the event was prevented by any of its subscribers.
boolean true if the default action was prevented. Otherwise, returns false.
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Set up the event handler of ticketReorder event.
<smart-gantt (ticketReorder)="onTicketReorder($event)"></smart-gantt>
onTicketReorder($event) { const detail = event.detail, data = detail.data, endData = detail.endData, id = detail.id; // event handling code goes here. }
this.gantt.addEventListener('ticketReorder', (event: CustomEvent) => { const detail = event.detail, data = detail.data, endData = detail.endData, id = detail.id; // event handling code goes here. })
Adds a new row. When you invoke the method, pass a JSON object with the row's data.
JSON object with the new row's data. Sample JSON: {firstName: 'Peter', lastName: 'Fuller'}.
Invoke the addRow method.
this.gantt.addRow({"firstName":"Peter","lastName":"Fuller"});
Adds a filter to a specific column.
The column's data field.
FilterGroup object.
Invoke the addFilter method.
this.gantt.addFilter("'firstName', filterGroup");
Begins an edit operation.
The id of the row to edit.
The dataField of the cell's column. May be omitted when editMode is 'row'.
Invoke the beginEdit method.
this.gantt.beginEdit("3, 'lastName'");
Begins an update operation. Suspends all table refreshes and renders.
Invoke the beginUpdate method.
this.gantt.beginUpdate();
Ends the current edit operation and discards changes.
Invoke the cancelEdit method.
this.gantt.cancelEdit();
Clears applied filters.
Invoke the clearFilters method.
this.gantt.clearFilters();
Clears selection.
Invoke the clearSelection method.
this.gantt.clearSelection();
Clears the Table sorting.
Invoke the clearSort method.
this.gantt.clearSort();
Collapses all row details. Rows that have details defined via the rowDetailTemplate will be collapsed.
Invoke the collapseAllRowDetails method.
this.gantt.collapseAllRowDetails();
Disables a selection of a row. When the 'selection' property is set to 'true', selection is enabled for all rows by default.
The id of the row (or an array of row ids) to select.
Invoke the disableSelect method.
this.gantt.disableSelect(2);
Enables a selection of a row, if it was previously disabled through a 'disableSelect' method call. When the 'selection' property is set to 'true', selection is enabled for all rows by default.
The id of the row (or an array of row ids) to select.
Invoke the enableSelect method.
this.gantt.enableSelect(2);
Ends the current edit operation and saves changes.
Invoke the endEdit method.
this.gantt.endEdit();
Ends an update operation. Resumes all table refreshes and renders. Re-renders the Table.
Optionally you can pass 'false' in case you need to manually call the 'refresh' method. By default, the table is re-rendered.
Invoke the endUpdate method.
this.gantt.endUpdate();
Expands all row details. Rows that have details defined via rowDetailTemplate will be expanded.
Invoke the expandAllRowDetails method.
this.gantt.expandAllRowDetails();
Returns an array of selected row ids.
Invoke the getSelection method.
const result = this.gantt.getSelection();
Returns the value of a cell.
The id of the cell's row.
The dataField of the cell's column.
Invoke the getValue method.
const result = this.gantt.getValue("3, 'lastName'");
Gets a column property.
Column field name.
Column property name.
Invoke the getColumnProperty method.
const result = this.gantt.getColumnProperty("firstName","width");
Refreshes the table.
Invoke the refresh method.
this.gantt.refresh();
Removes filters applied to a specific column.
The column's data field.
Invoke the removeFilter method.
this.gantt.removeFilter();
Removes a row by its id.
The id of the cell's row.
Invoke the removeRow method.
this.gantt.removeRow(1);
Selects one or more rows.
The id of the row (or an array of row ids) to select.
Invoke the select method.
this.gantt.select(2);
Sets the value of a cell.
The id of the cell's row.
The dataField of the cell's column.
The new value of the cell.
Invoke the setValue method.
this.gantt.setValue("3, 'lastName', 'Green'");
Sorts the Table by a column.
Column field name.
Sort order. Possible values: 'asc' (ascending), 'desc' (descending), and null (removes sorting by column). If not provided, toggles the sorting.
Invoke the sortBy method.
this.gantt.sortBy("firstName");
Sets a column property.
Column field name.
Column property name.
Property value.
Invoke the setColumnProperty method.
this.gantt.setColumnProperty("firstName","width","300");
Updates a table row. The method expects two parameters - row id and JSON object with the new row data.
The id of the row.
JSON object with the new row's data. Example: {firstName: 'Peter', lastName: 'Fuller'}.
Invoke the updateRow method.
this.gantt.updateRow(3,{"firstName":"Peter","lastName":"Fuller"});
Unselects one or more rows.
The id of the row (or an array of row ids) to unselect.
Invoke the unselect method.
this.gantt.unselect(5);
Sets or gets the column group's label that appears in the column header hierarchy.
Get the label property.
let label = this.gantt.columnGroups[0].label;
Sets or gets the column group's unique name that is referenced in the columnGroup field of columns (TableColumn).
Get the name property.
let name = this.gantt.columnGroups[0].name;
Sets or gets the name of the column group's parent group (also defined in columnGroups).
Get the parentGroup property.
let parentGroup = this.gantt.columnGroups[0].parentGroup;
Sets or gets whether the column's cells can be edited.
Get the allowEdit property.
let allowEdit = this.gantt.columns[0].allowEdit;
Sets or gets whether the column can be filtered.
Get the allowFilter property.
let allowFilter = this.gantt.columns[0].allowFilter;
Sets or gets whether the column can be resized.
Get the allowResize property.
let allowResize = this.gantt.columns[0].allowResize;
Sets or gets whether the table can be sorted by the column.
Get the allowSort property.
let allowSort = this.gantt.columns[0].allowSort;
Sets or gets the column's column group. Has to correspond to the name field of a column group (TableColumnGroup).
Get the columnGroup property.
let columnGroup = this.gantt.columns[0].columnGroup;
Sets or gets the column's data source-bound field.
Get the dataField property.
let dataField = this.gantt.columns[0].dataField;
Sets or gets the data type of the column's cells.
Get the dataType property.
let dataType = this.gantt.columns[0].dataType;
Sets or gets whether the column is sticky/frozen. true and 'near' designate freezing on the left side, 'far' - on the right side.
Get the freeze property.
let freeze = this.gantt.columns[0].freeze;
A callback function that can be used to modify the contents of a cell and the cell itself.
Get the formatFunction property.
let formatFunction = this.gantt.columns[0].formatFunction;
Sets or gets the text displayed in the column's header.
Get the label property.
let label = this.gantt.columns[0].label;
Sets or gets the data field map, when the Table is bound to an Array and dataSourceSettings property is not set.
Get the map property.
let map = this.gantt.columns[0].map;
Sets or gets the column's priority when resizing the browser window. The larger the priority value, the column will be hidden at a larger screen resolution. Columns with priority 1 are never hidden. The property should be set to a number in the range of 1 to 5. The property by default is not set.
Get the responsivePriority property.
let responsivePriority = this.gantt.columns[0].responsivePriority;
Use this for custom sort implementation only. All non-undefined array elements are sorted according to the return value of the compare function (all undefined elements are sorted to the end of the array, with no call to compareFunction).
Get the sort property.
let sort = this.gantt.columns[0].sort;
A string to be parsed into HTML and be used as custom cell content. Applicable only when virtualization is enabled.
Get the templateElement property.
let templateElement = this.gantt.columns[0].templateElement;
A callback function that can be used to apply settings to a template element (specified by the column templateElement property). Applicable only when virtualization is enabled.
Get the templateElementSettings property.
let templateElementSettings = this.gantt.columns[0].templateElementSettings;
A callback function that can be used to transform all the data of the column's original data field into a new data field to be used in column cells and all column operations. Can be useful for localizing data.
Get the transform property.
let transform = this.gantt.columns[0].transform;
A callback function that can be used to validate cell values after editing. If it returns true, the cell is valid. If it returns false or an object with a message field, the cell is not valid and the message (or a default one) is displayed in a tooltip.
Get the validation property.
let validation = this.gantt.columns[0].validation;
Sets or gets whether the column is hidden or not. Hidden columns allow data to be grouped by their corresponding dataField.
Get the visible property.
let visible = this.gantt.columns[0].visible;
Sets the width of the column. The width can be entered as a number or string with px.
Get the width property.
let width = this.gantt.columns[0].width;
Sets or gets whether a column will be auto-generated.
Set the autoGenerateColumns property by using the component's instance.
this.gantt.dataSourceSettings[0].autoGenerateColumns = false;
Get the autoGenerateColumns property.
let autoGenerateColumns = this.gantt.dataSourceSettings[0].autoGenerateColumns;
Sets or gets a children data field like 'children', 'items' in the data source. When this property is set, the dataAdapter will look for this data field when looping through the items. If it is found a hierarchical data source would be created.
Set the childrenDataField property by using the component's instance.
this.gantt.dataSourceSettings[0].childrenDataField = 'children';
Get the childrenDataField property.
let childrenDataField = this.gantt.dataSourceSettings[0].childrenDataField;
Sets or gets the XML binding root.
Set the root property by using the component's instance.
this.gantt.dataSourceSettings[0].root = 'children';
Get the root property.
let root = this.gantt.dataSourceSettings[0].root;
Sets or gets the XML binding root.
Set the sanitizeHTML property by using the component's instance.
this.gantt.dataSourceSettings[0].sanitizeHTML = 'blackList';
Get the sanitizeHTML property.
let sanitizeHTML = this.gantt.dataSourceSettings[0].sanitizeHTML;
Sets or gets the XML binding record.
Set the record property by using the component's instance.
this.gantt.dataSourceSettings[0].record = 'children';
Get the record property.
let record = this.gantt.dataSourceSettings[0].record;
Sets or gets the data fields to group by.
Set the groupBy property by using the component's instance.
this.gantt.dataSourceSettings[0].groupBy = true;
Get the groupBy property.
let groupBy = this.gantt.dataSourceSettings[0].groupBy;
Sets or gets the data fields which decribe the loaded data and data type. Ex: ['id: number', 'firstName: string', 'lastName: string']
Set the dataFields property by using the component's instance.
this.gantt.dataSourceSettings[0].dataFields = [id: number];
Get the dataFields property.
let dataFields = this.gantt.dataSourceSettings[0].dataFields;
Sets or gets whether the data source type.
Set the dataSourceType property by using the component's instance.
this.gantt.dataSourceSettings[0].dataSourceType = 'json';
Get the dataSourceType property.
let dataSourceType = this.gantt.dataSourceSettings[0].dataSourceType;
Sets or gets the dataAdapter's id
Get the id property.
let id = this.gantt.dataSourceSettings[0].id;
Sets or gets the key data field to be used for building the hierarchy. It is used in combination with the parentDataField property. Usually the 'id' field is used as key data field and 'parentId' as parent data field'
Set the keyDataField property by using the component's instance.
this.gantt.dataSourceSettings[0].keyDataField = 'uid';
Get the keyDataField property.
let keyDataField = this.gantt.dataSourceSettings[0].keyDataField;
Sets or gets the parent data field to be used for building the hierarchy. It is used in combination with the keyDataField property. Usually the 'id' field is used as key data field and 'parentId' as parent data field'
Set the parentDataField property by using the component's instance.
this.gantt.dataSourceSettings[0].parentDataField = 'uid';
Get the parentDataField property.
let parentDataField = this.gantt.dataSourceSettings[0].parentDataField;
Sets the 'mapChar' data field of the record
Set the mapChar property by using the component's instance.
this.gantt.dataSourceSettings[0].mapChar = 'uid';
Get the mapChar property.
let mapChar = this.gantt.dataSourceSettings[0].mapChar;
Sets the virtual data source function which is called each time the Grid requests data. Demos using 'virtualDataSource' are available on the Grid demos page.
Get the virtualDataSource property.
let virtualDataSource = this.gantt.dataSourceSettings[0].virtualDataSource;
Sets the virtual data source on expand function. This function is called when we load data on demand in Tree or TreeGrid and virtualDataSource in these components is set, too
Get the virtualDataSourceOnExpand property.
let virtualDataSourceOnExpand = this.gantt.dataSourceSettings[0].virtualDataSourceOnExpand;
Sets the dataField name.
Get the name property.
let name = this.gantt.dataSourceSettings[0].dataFields[0].name;
Sets the dataField mapping path. For nested mapping, use '.'. Example: 'name.firstName'.
Get the map property.
let map = this.gantt.dataSourceSettings[0].dataFields[0].map;
Sets the dataField type.
Get the dataType property.
let dataType = this.gantt.dataSourceSettings[0].dataFields[0].dataType;
import { NgModule } from '@angular/core'; import { GanttComponent } from './smart.gantt'; @NgModule({ declarations: [GanttComponent], exports: [GanttComponent] }) export class GanttModule { }
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { GanttModule } from 'smart-webcomponents-angular/gantt'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, GanttModule ], bootstrap: [ AppComponent ], entryComponents: [ AppComponent ] }) export class AppModule { }