bug fixed
This commit is contained in:
parent
ea2e952586
commit
644a3322df
@ -96,6 +96,19 @@ const QuarterlyWindows = () => {
|
|||||||
key: null,
|
key: null,
|
||||||
direction: 'asc'
|
direction: 'asc'
|
||||||
});
|
});
|
||||||
|
const extractText = (node) => {
|
||||||
|
if (typeof node === "string") return node;
|
||||||
|
if (typeof node === "number") return String(node);
|
||||||
|
|
||||||
|
if (node?.props?.children) {
|
||||||
|
if (Array.isArray(node.props.children)) {
|
||||||
|
return node.props.children.map(extractText).join(" ");
|
||||||
|
}
|
||||||
|
return extractText(node.props.children);
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
// Format date to yyyy-MM-dd for input fields
|
// Format date to yyyy-MM-dd for input fields
|
||||||
const formatDateForInput = (dateString) => {
|
const formatDateForInput = (dateString) => {
|
||||||
@ -709,10 +722,14 @@ const handleSave = async () => {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!filteredRows.length) return;
|
if (!filteredRows.length) return;
|
||||||
|
// const csvHeader = headers
|
||||||
|
// .filter((h) => h.name !== 'Actions')
|
||||||
|
// .map((h) => `"${h.name}"`)
|
||||||
|
// .join(',');
|
||||||
const csvHeader = headers
|
const csvHeader = headers
|
||||||
.filter((h) => h.name !== 'Actions')
|
.filter((h) => extractText(h.name) !== 'Actions') // remove Actions
|
||||||
.map((h) => `"${h.name}"`)
|
.map((h) => `"${extractText(h.name)}"` ) // extract plain text
|
||||||
.join(',');
|
.join(',');
|
||||||
const csvRows = filteredRows.map((item) => {
|
const csvRows = filteredRows.map((item) => {
|
||||||
const rowData = [
|
const rowData = [
|
||||||
item.survey_name || '',
|
item.survey_name || '',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user