diff --git a/app/src/protyle/render/av/groups.ts b/app/src/protyle/render/av/groups.ts index 7a03a9398..18c682de2 100644 --- a/app/src/protyle/render/av/groups.ts +++ b/app/src/protyle/render/av/groups.ts @@ -10,10 +10,13 @@ export const setGroupMethod = (options: { fieldId: string; data: IAV; menuElement: HTMLElement, - blockElement: HTMLElement, + blockElement: Element, }) => { + const blockID = options.blockElement.getAttribute("data-block-id"); transaction(options.protyle, [{ action: "setAttrViewGroup", + avID: options.data.id, + blockID, data: { field: options.fieldId, method: null, @@ -22,31 +25,33 @@ export const setGroupMethod = (options: { } }], [{ action: "setAttrViewGroup", + avID: options.data.id, + blockID, data: { - field: options.data.view.groups?.field || "", + field: options.data.view.group?.field || "", method: null, order: null, range: null } }]); - if (!options.data.view.groups) { - options.data.view.groups = { + if (!options.data.view.group) { + options.data.view.group = { field: options.fieldId }; } else { - options.data.view.groups.field = options.fieldId; + options.data.view.group.field = options.fieldId; } - options.menuElement.innerHTML = getGroupsHTML(getFieldsByData(options.data), options.data.view.groups); + options.menuElement.innerHTML = getGroupsHTML(getFieldsByData(options.data), options.data.view.group); // bindGroupsEvent(options.protyle, options.menuElement, options.data, blockID); const tabRect = options.blockElement.querySelector(".av__views").getBoundingClientRect(); setPosition(options.menuElement, tabRect.right - options.menuElement.clientWidth, tabRect.bottom, tabRect.height); }; -export const getGroupsMethodHTML = (columns: IAVColumn[], groups: IAVGroups) => { +export const getGroupsMethodHTML = (columns: IAVColumn[], group: IAVGroup) => { const selectHTML = ''; let html = ``; columns.forEach(item => { html += ``; }); return `
`; }; -export const getGroupsHTML = (columns: IAVColumn[], groups: IAVGroups) => { +export const getGroupsHTML = (columns: IAVColumn[], group: IAVGroup) => { let html = ""; - if (groups) { + if (group) { html = `