private calcIndex() {
if (this.dashboard.panels.length > 0) {
let SortCompare2 = function(
field1: string,
field2: string,
Ascending: boolean = true
) {
return function(a, b) {
if (Ascending) {
if (a[field1] > b[field1]) {
return 1;
} else if (a[field1] < b[field1]) {
return -1;
} else {
if (a[field2] > b[field2]) {
return 1;
} else {
return -1;
}
}
} |
Hi Shalini,
What I want to fulfil is:
When the user clicks “New”, the new Panel will fill in spare space, therefore, it is required to calculate the position of the last record.
However, in case of some records were deleted, and then to add a new Panel and delete, it has the error encountered.
Hi Shalini,
The [Iwant.gif] is what I want.
The [wrong.gif] is the demo that you sent to me, which doesn't result the effects I need.
this._pan = this.dashboard.serialize();
for (let panel of this._pan.sort(SortCompare2('row', 'col'))) {
if (rowIndex < panel.row) {
|