bug fixed

This commit is contained in:
Malini 2025-12-11 17:22:38 +05:30
parent ea2e952586
commit 644a3322df

View File

@ -96,6 +96,19 @@ const QuarterlyWindows = () => {
key: null,
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
const formatDateForInput = (dateString) => {
@ -709,10 +722,14 @@ const handleSave = async () => {
type="button"
onClick={() => {
if (!filteredRows.length) return;
// const csvHeader = headers
// .filter((h) => h.name !== 'Actions')
// .map((h) => `"${h.name}"`)
// .join(',');
const csvHeader = headers
.filter((h) => h.name !== 'Actions')
.map((h) => `"${h.name}"`)
.join(',');
.filter((h) => extractText(h.name) !== 'Actions') // remove Actions
.map((h) => `"${extractText(h.name)}"` ) // extract plain text
.join(',');
const csvRows = filteredRows.map((item) => {
const rowData = [
item.survey_name || '',