Grid.removeItem issue

This commit is contained in:
Chen Lily 2024-01-29 09:29:37 +08:00
parent fc61731c7d
commit b5fd20aa2c
3 changed files with 12 additions and 4 deletions

View File

@ -257,8 +257,9 @@ export class Grid {
*
* @param item
* @param index
* @returns
*/
addItem(item: GridItem, index?: number): void;
addItem(item: GridItem, index?: number): GridItem;
/**
*
* @param index

View File

@ -200,6 +200,7 @@ export class Grid {
}
}
this.reload();
return item;
}
removeItem(index) {
@ -213,11 +214,11 @@ export class Grid {
if (this._var.colAttrs.__filtered === true) {
this._var.source.splice(it.__index, 1);
}
for (let i = it.__index + 1; i < this._var.source.length; --i) {
for (let i = it.__index; i < this._var.source.length; ++i) {
this._var.source[i].__index -= 1;
}
this.reload();
return item;
return it.values;
}
_refreshSource(list) {

View File

@ -45,8 +45,14 @@ export function formatUrl(msg) {
}
}
let path;
if (typeof consts !== 'undefined') {
path = consts.path;
} else if (typeof _network !== 'undefined') {
path = _network.root;
}
for (let r of rs) {
msg = msg.replaceAll(r, '<a target="_blank" href="' + r + '"><svg><use xlink:href="' + ((typeof consts !== 'undefined' && consts.path) || '') + 'fonts/fa-regular.svg#link"></use></svg></a>');
msg = msg.replaceAll(r, `<a target="_blank" href="${r}"><svg><use xlink:href="${path || ''}fonts/fa-regular.svg#link"></use></svg></a>`);
}
}