How to insert hierarchical items with indentation to GanttChartView control from Gantt Chart Hyper Library

By design, when you insert new items to a specific index within GanttChartView control from Gantt Chart Hyper Library using the insertItems method all new items are inserted with their indentation property coerced down to the insertion point item's indentation.

Therefore, if you plan to insert a hierarchical set of new items at a specific position in the collection, you will need to postpone indentation increasing for after loading the items:

var items = [{ content: "New task 1" },
             { content: "New task 1.1", intendedIndentationIncrease: 1,
               start: new Date(2012, 8, 2, 8, 0, 0), finish: new Date(2012, 8, 4, 16, 0, 0) },
             { content: "New task 1.2", intendedIndentationIncrease: 1,
               start: new Date(2012, 8, 3, 8, 0, 0), finish: new Date(2012, 8, 5, 12, 0, 0) }];
ganttChartView.insertItems(ganttChartView.selectedItem.index, items);
for (var i = 0; i < items.length; i++) {
    var item = items[i];
    if (item.intendedIndentationIncrease) {
        for (var j = 0; j < item.intendedIndentationIncrease; j++)
            ganttChartView.increaseItemIndentation(item);
    }
}