define(["require", "exports", "@syncfusion/ej2-grids"], function (require, exports, ej2_grids_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Reorder = (function () {
function Reorder(parent) {
ej2_grids_1.Grid.Inject(ej2_grids_1.Reorder);
this.parent = parent;
this.addEventListener();
}
Reorder.prototype.getModuleName = function () {
return 'reorder';
};
Reorder.prototype.addEventListener = function () {
this.parent.on('getColumnIndex', this.getTreeColumn, this);
};
Reorder.prototype.removeEventListener = function () {
if (this.parent.isDestroyed) {
return;
}
this.parent.off('getColumnIndex', this.getTreeColumn);
};
Reorder.prototype.destroy = function () {
this.removeEventListener();
};
Reorder.prototype.getTreeColumn = function () {
var columnModel = 'columnModel';
var treeColumn = this.parent["" + columnModel][this.parent.treeColumnIndex];
var treeIndex;
var updatedCols = this.parent.getColumns();
for (var f = 0; f < updatedCols.length; f++) {
var treeColumnfield = ej2_grids_1.getObject('field', treeColumn);
var parentColumnfield = ej2_grids_1.getObject('field', updatedCols[parseInt(f.toString(), 10)]);
if (treeColumnfield === parentColumnfield) {
treeIndex = f;
break;
}
}
this.parent.setProperties({ treeColumnIndex: treeIndex }, true);
};
return Reorder;
}());
exports.Reorder = Reorder;
});
|