[]
        
(Showing Draft Content)

GC.Spread.Sheets.GanttSheet.GanttSheet

Class: GanttSheet

Sheets.GanttSheet.GanttSheet

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new GanttSheet(name?, dataView?)

Creates a GanttSheet with specified data view and options.

Parameters

Name Type
name? string
dataView? View

Overrides

TableSheet.constructor

Properties

gridlines

gridlines: GanttGridlines

Gets the gridline for gantt chart, and configure the line types and colors.

readonly


mapping

mapping: GanttMapping

Gets the mapping of this GanttSheet used to convert or convert back the data in view.

readonly


options

options: ITableSheetOptions

Represents the options of the table sheet.

property [allowAddNew] - Whether to allow to add new empty row.

property [sheetTabColor] - A color string used to represent the sheet tab color, such as "red", "#FFFF00", "rgb(255,0,0)", "Accent 5", and so on.

property [alternatingRowOptions] - Defines the alternating row style options.

property [defaultStackRowHeight] - Tablesheet default stack row height, will calculate the average height by default.

property [menuItemVisibility] - Tablesheet default stack row height, will calculate the average height by default.

example

//This example changes a TableSheet's options.
tableSheet.options.allowAddNew = false;
tableSheet.options.alternatingRowOptions = { step: [1, 1], style: new GC.Spread.Sheets.Style("lightyellow")};

Inherited from

TableSheet.options


project

project: Project

Gets the project to display and edit of this GanttSheet.

readonly

Methods

addHierarchyItemAbove

addHierarchyItemAbove(row, rowData): void

Add a new row data as the parent of the specified row.

example

//This example adds a new row data as the parent of the specified row.
tableSheet.addHierarchyItemAbove(8, {id: 8, name: "spreadjs"});

Parameters

Name Type Description
row number The row index.
rowData any The row data.

Returns

void

Inherited from

TableSheet.addHierarchyItemAbove


addHierarchyItemAfter

addHierarchyItemAfter(row, rowData): void

Add a new row data after the specified row.

example

//This example adds a new row data after the specified row.
tableSheet.addHierarchyItemAfter(8, {id: 8, name: "spreadjs"});

Parameters

Name Type Description
row number The row index.
rowData any The row data.

Returns

void

Inherited from

TableSheet.addHierarchyItemAfter


addHierarchyItemBefore

addHierarchyItemBefore(row, rowData): void

Add a new row data before the specified row.

example

//This example adds a new row data before the specified row.
tableSheet.addHierarchyItemBefore(8, {id: 8, name: "spreadjs"});

Parameters

Name Type Description
row number The row index.
rowData any The row data.

Returns

void

Inherited from

TableSheet.addHierarchyItemBefore


addHierarchyItemBelow

addHierarchyItemBelow(row, rowData): void

Add a new row data as the child of the specified row.

example

//This example adds a new row data as the child of the specified row.
tableSheet.addHierarchyItemBelow(8, {id: 8, name: "spreadjs"});

Parameters

Name Type Description
row number The row index.
rowData any The row data.

Returns

void

Inherited from

TableSheet.addHierarchyItemBelow


addRow

addRow(rowData): void

Adds a new row to table sheet.

example

//This example adds a new row with data.
tableSheet.addRow({id: 8, name: "spreadjs"});

Parameters

Name Type Description
rowData any The row data.

Returns

void

Inherited from

TableSheet.addRow


applyFreeHeaderArea

applyFreeHeaderArea(sheetJson?): any

Applies a Worksheet JSON to a TableSheet column header free layout area.

Parameters

Name Type Description
sheetJson? any a Worksheet JSON, which can be gotten easily by Worksheet's toJSON method.

Returns

any

Inherited from

TableSheet.applyFreeHeaderArea


applyTableTheme

applyTableTheme(tableTheme): void

Applies a table theme to current TableSheet.

Parameters

Name Type Description
tableTheme TableTheme A table theme instance.

Returns

void

Inherited from

TableSheet.applyTableTheme


bindGanttView

bindGanttView(dataView, options?): void

Sets the data view of table sheet.

Parameters

Name Type Description
dataView View The data view to bind.
options? IGanttSheetOptions -

Returns

void


cancelChanges

cancelChanges(): void

Cancels the changes of data manager in batch mode.

example

//This example cancel changes manually in batch mode.
tableSheet.cancelChanges();

Returns

void

Inherited from

TableSheet.cancelChanges


collapseAllHierarchyLevels

collapseAllHierarchyLevels(): void

Collapse the all hierarchy levels.

example

//This example collapse the all hierarchy levels.
tableSheet.collapseAllHierarchyLevels();

Returns

void

Inherited from

TableSheet.collapseAllHierarchyLevels


demoteHierarchyLevel

demoteHierarchyLevel(row, withChildren?): void

Demote the hierarchy data level of the specified row.

example

//This example demote the hierarchy data level by specified index.
tableSheet.demoteHierarchyLevel(8);

Parameters

Name Type Description
row number The row index.
withChildren? boolean Optional, the children will be demoted with the record by default.

Returns

void

Inherited from

TableSheet.demoteHierarchyLevel


detailColumnsVisible

detailColumnsVisible(value?): boolean

Whether to show or hide the detail columns after Table Sheet is grouped.

example

//This sample shows how to hide the detail columns.
tableSheet.detailColumnsVisible(false);

Parameters

Name Type Description
value? boolean A boolean value which indicates the visibility of the detail columns.

Returns

boolean

Returns the visibility of the detail columns.

Inherited from

TableSheet.detailColumnsVisible


expandAllHierarchyLevels

expandAllHierarchyLevels(): void

Expand the all hierarchy levels.

example

//This example expand the all hierarchy levels.
tableSheet.expandAllHierarchyLevels();

Returns

void

Inherited from

TableSheet.expandAllHierarchyLevels


expandGroup

expandGroup(field, expand): void

Expands or collapses one level grouping by the specified field.

example

//This sample shows how to collapse one level grouping, which is grouped by "LastName".
tableSheet.expandGroup("LastName", false);

Parameters

Name Type Description
field string The field name.
expand boolean A boolean value, true means expanding the grouping, false means collapsing the grouping.

Returns

void

Inherited from

TableSheet.expandGroup


expandGroupItem

expandGroupItem(level, index, expand): void

Expands or collapses one grouping by the specified level and index.

example

//This sample shows how to collapse one grouping, which level is 1 and start index is 10.
tableSheet.expandGroupItem(1, 10, false);

Parameters

Name Type Description
level number The grouping level.
index number The grouping start index.
expand boolean A boolean value, true means expanding the grouping, false means collapsing the grouping.

Returns

void

Inherited from

TableSheet.expandGroupItem


expandHierarchyLevel

expandHierarchyLevel(level): void

Expand the hierarchy data by specified level.

example

//This example expand the hierarchy data by specified level.
tableSheet.expandHierarchyLevel(8);

Parameters

Name Type Description
level number The level to expand.

Returns

void

Inherited from

TableSheet.expandHierarchyLevel


getActiveTask

getActiveTask(): Task

Gets the task at the active row.

Returns

Task

The task at the active row.


getChanges

getChanges(): IDataViewChanges[]

Gets the changes of data manager in autoSync or batch mode.

example

//This example get changes manually in autoSync or batch mode, including updated rows, inserted rows and deleted rows.
tableSheet.getChanges();

Returns

IDataViewChanges[]

Returns a object array, each object could contain "type", "dataItem", "oldDataItem", and "index". The "type" is the change type, could be one of "insert", "update" or "delete". the "dataItem" is the current row data. The "oldDataItem" is the original row data, only used for "update". The "index" is the view index of table sheet.

Inherited from

TableSheet.getChanges


getDataView

getDataView(): View

Gets the data view of table sheet.

example

//This example gets the data source.
tableSheet.getDataView();

Returns

View

Returns the data view.

Inherited from

TableSheet.getDataView


getSelections

getSelections(): Range[]

Gets the selection ranges.

Returns

Range[]

The selected ranges.


getTaskByRow

getTaskByRow(rowIndex): Task

Gets the task at the specified row.

Parameters

Name Type Description
rowIndex number A number indicates the row index.

Returns

Task

The task at the specified row.


groupBy

groupBy(options?): IGroupByOptions[]

group the table sheet by options

example

//This example sets group options and group the table sheet.
tablesheet.groupBy([
     {
         caption: 'Category',
         field: 'category',
         summaryFields:[
             {
                 caption: 'SUM(Quantity)', width: 120, style: { formatter: "$ #,##0.00" }
                 formula: '=SUM([Quantity])',
                 slice: 'Office'
             }
         ]
     }
 ])

Parameters

Name Type Description
options? IGroupByOptions[] The options of the groupBy

Returns

IGroupByOptions[]

Inherited from

TableSheet.groupBy


groupOutlinePosition

groupOutlinePosition(value?): boolean

Whether to show or hide the grouping outline in viewport area and column header area, or row header area after Table Sheet is grouped.

example

//This sample shows how to hide the grouping outline.
tableSheet.groupOutlinePosition(GC.Spread.Sheets.TableSheet.GroupOutlinePosition.none);

Parameters

Name Type Description
value? GroupOutlinePosition A value which indicates the position of the grouping outline.

Returns

boolean

Returns the position of the grouping outline.

Inherited from

TableSheet.groupOutlinePosition


hasRowState

hasRowState(type, row): boolean

Judges the row with the specified state.

example

//This example judges the row with the specified state.
tableSheet.hasRowState(GC.Data.RowColumnStates.selected, 0);

Parameters

Name Type Description
type RowColumnStates The type of row states.
row number The row index.

Returns

boolean

Inherited from

TableSheet.hasRowState


moveDown

moveDown(row): void

Move the hierarchy data by the specified row down.

example

//This example move the hierarchy data by specified index down.
tableSheet.moveDown(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.moveDown


moveUp

moveUp(row): void

Move the hierarchy data by the specified row up.

example

//This example move the hierarchy data by specified index up.
tableSheet.moveUp(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.moveUp


printInfo

printInfo(value?): any

Gets or sets the print information for the table sheet.

example

//This example sets print info.
var printInfo = tableSheet.printInfo();
printInfo.bestFitRows(true);
printInfo.bestFitColumns(true);
tableSheet.printInfo(printInfo);

Parameters

Name Type
value? PrintInfo

Returns

any

If no value is set, returns the print information for the table sheet; otherwise, returns the table sheet.

Inherited from

TableSheet.printInfo


promoteHierarchyLevel

promoteHierarchyLevel(row): void

Promote the hierarchy data level of the specified row.

example

//This example promote the hierarchy data level by specified index.
tableSheet.promoteHierarchyLevel(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.promoteHierarchyLevel


removeGroupBy

removeGroupBy(): void

remove group status of the table sheet

example

//This example shows removing the group status of the table sheet.
tablesheet.removeGroupBy()

Returns

void

Inherited from

TableSheet.removeGroupBy


removeRow

removeRow(row): void

Removes the specified row from table sheet.

example

//This example removes a row by specified index.
//The changes will be synchronized when the autoSync be true.
tableSheet.removeRow(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.removeRow


resetRow

resetRow(row): void

Resets the changes of the specified row of table sheet.

example

//This example resets a row by specified index.
tableSheet.resetRow(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.resetRow


resumePaint

resumePaint(): void

Resumes the paint of gantt sheet.

Returns

void


rowActionOptions

rowActionOptions(options?): IRowActionOptions[]

Gets or sets the options of the row action.

example

//This example set the options of the row action.
let options = tableSheet.rowActionOptions();
options.push({
     icons: ["./comment.png"],
     iconSelector: (item) => {
         return item.comment && item.comment.length > 0;
     }
 });
tableSheet.rowActionOptions(options);

Parameters

Name Type Description
options? IRowActionOptions[] The options of the row action.

Returns

IRowActionOptions[]

Inherited from

TableSheet.rowActionOptions


saveRow

saveRow(row): void

Saves the changes of the specified row of table sheet to data manager, including updated row or and inserted row.

example

//This example saves a row by specified index.
//The changes will be synchronized when the autoSync be true.
tableSheet.saveRow(8);

Parameters

Name Type Description
row number The row index.

Returns

void

Inherited from

TableSheet.saveRow


setDataView

setDataView(dataView): void

Sets the data view of table sheet.

example

//This example sets the data source.
var dataManager = spread.dataManager();
var myTable = dataManager.addTable("myTable", {
    remote: {
        read: {
            url: 'https://demodata.mescius.io/northwind/api/v1/Orders'
        }
    }
});
myTable.fetch().then(function() {
    var myView = myTable.addView("myView");
    tableSheet.setDataView(myView);
});

Parameters

Name Type Description
dataView View The data view to bind.

Returns

void

Inherited from

TableSheet.setDataView


setDefaultRowHeight

setDefaultRowHeight(value, sheetArea?): void

Sets the default height in pixels for the all rows in the viewport area.

example

//This example sets the default row height in pixels.
tableSheet.setDefaultRowHeight(50);

Parameters

Name Type Description
value number The height in pixels.
sheetArea? SheetArea -

Returns

void

Inherited from

TableSheet.setDefaultRowHeight


submitChanges

submitChanges(): void

Submits the changes of data manager to server in batch mode, including updated rows, inserted rows and deleted rows.

example

//This example submit changes manually in batch mode.
tableSheet.submitChanges();

Returns

void

Inherited from

TableSheet.submitChanges


suspendPaint

suspendPaint(): void

Suspends the paint of gantt sheet.

Returns

void


togglePinnedColumns

togglePinnedColumns(index): void

Pin or unpin columns with specified column index array.

example

//This example pin several columns.
tableSheet.togglePinnedColumns([1,2,4]);

Parameters

Name Type Description
index number[] The array of column indexes to do pin or unpin.

Returns

void

Returns the count of the pinned columns.

Inherited from

TableSheet.togglePinnedColumns


togglePinnedRows

togglePinnedRows(indexes): void

Pin or unpin rows with specified row index array.

example

//This example pin several rows.
tableSheet.togglePinnedRows([1,2,4]);

Parameters

Name Type
indexes number[]

Returns

void

Returns the count of the pinned rows.

Inherited from

TableSheet.togglePinnedRows