Task Complete

The Task Complete Column is the current status of a task, expressed as a percentage completed.

Description
app.js
index.html
styles.css
Copy to CodeMine

Task Complete Column

The task complete column is represented as a float number. To enable it, you need to add the "complete" field in you source data.

The normal task complete data is fetched directly from source data, whereas the summary task complete data will be a result of calculation.

The calculation formula: the total actual duration of tasks / the total estimated duration of tasks * 100%

You can define a complete column in your gantt view with the following code:

var view = myTable.addView("ganttView", [
    ...
    { value: "complete" }
    ...
]);

With that code, the complete bar should show inside of the taskbar.

Complete Cell Type

You can click the buttons of the cell in the complete column to increase or decrease the complete value.

Drag to Change Complete

When you add a complete column into the gantt view, you can drag to change the complete value inside of the taskbar.

API

You can use API to set/get the task complete column directly.

class Task {
    /**
     * Gets or sets a float number that indicates the complete percentage of this task. The value could be 0 to 1.
     * @type {number}
     */
    complete: number;

    /**
     * Gets or sets a Date value that indicates the progress of a task. It is the point up to which actual have been reported for the task.
     * @type {Date}
     */
    completeThrough: Date;
}

Sample:

var task = ganttSheet.getTaskByRow(10);
// get complete
console.log(task.complete);
// set complete
task.complete = 0.5;
// get complete through
console.log(task.completeThrough);
// set complete through
task.completeThrough = task.finish;
Task Complete Column The task complete column is represented as a float number. To enable it, you need to add the "complete" field in you source data. The normal task complete data is fetched directly from source data, whereas the summary task complete data will be a result of calculation. The calculation formula: the total actual duration of tasks / the total estimated duration of tasks * 100% You can define a complete column in your gantt view with the following code: With that code, the complete bar should show inside of the taskbar. Complete Cell Type You can click the buttons of the cell in the complete column to increase or decrease the complete value. Drag to Change Complete When you add a complete column into the gantt view, you can drag to change the complete value inside of the taskbar. API You can use API to set/get the task complete column directly. Sample:
/*REPLACE_MARKER*/ /*DO NOT DELETE THESE COMMENTS*/ window.onload = function() { var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"), { sheetCount: 0 }); initSpread(spread); }; function initSpread(spread) { spread.suspendPaint(); initGanttSheet(spread); spread.resumePaint(); } function initGanttSheet(spread) { var tableName = "Gantt_Mode"; var baseApiUrl = getBaseApiUrl(); var apiUrl = baseApiUrl + "/" + tableName; var dataManager = spread.dataManager(); var myTable1 = dataManager.addTable("myTable1", { batch: true, remote: { read: { url: apiUrl }, batch: { url: apiUrl + "Collection" } }, schema: { hierarchy: { type: "Parent", column: "parentId" }, columns: { id: { isPrimaryKey: true }, taskNumber: { dataType: "rowOrder" } } } }); var ganttSheet = spread.addSheetTab(0, "GanttSheet1", GC.Spread.Sheets.SheetType.ganttSheet); var view = myTable1.addView("myView1", [ { value: "taskNumber", caption: "NO", width: 60 }, { value: "name", caption: "Task Name", width: 200 }, { value: "duration", caption: "Duration", width: 90 }, { value: "predecessors", caption: "Predecessors", width: 120 }, { value: "complete", caption: "% Complete", width: 100 }, ]); view.fetch().then(function() { ganttSheet.bindGanttView(view); }); } function getBaseApiUrl() { return window.location.href.match(/http.+spreadjs\/demos\//)[0] + 'server/api'; }
<!doctype html> <html style="height:100%;font-size:14px;"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" href="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/styles/gc.spread.sheets.excel2013white.css"> <!-- Promise Polyfill for IE, https://www.npmjs.com/package/promise-polyfill --> <script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets/dist/gc.spread.sheets.all.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-tablesheet/dist/gc.spread.sheets.tablesheet.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/en/purejs/node_modules/@mescius/spread-sheets-ganttsheet/dist/gc.spread.sheets.ganttsheet.min.js" type="text/javascript"></script> <script src="$DEMOROOT$/spread/source/js/license.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <div class="sample-tutorial"> <div id="ss" class="sample-spreadsheets"></div> <div id="optionContainer" class="optionContainer"> </div> </div> </html>
.sample-tutorial { width: 100%; height: 100%; } body, html { padding: 0; margin: 0; width: 100%; height: 100%; position: relative; overflow: hidden; } .sample-spreadsheets { width: 100%; height: 100%; }