luckysheet-react icon indicating copy to clipboard operation
luckysheet-react copied to clipboard

How to disable Columns and Rows in Lucksheet

Open shahbaazali20 opened this issue 2 years ago • 0 comments

I try to disabled headers row in lucky sheet but I don't get any soln. of it. I am using ReactJs. Plese Help.

`import { useEffect, useRef } from 'react';

export const CaptableGrid = ({ isInvestor = false }) => {

const LUCKYDATA = [
	[
		'First Name',
		'Last Name',
		'Country Code',
		'Mobile',
		'Email',
	],
	['', '', '', '', '', '', '', ''],
];

const tableArray: any = [];
(isInvestor ? LUCKYDATA?.forEach(
	(rows: any, rowIndex: any) => {
		rows.forEach((row: any, colIndex: any) => {
			const cellObj = {
				r: rowIndex,
				c: colIndex,
				v: {
					ct: { fa: 'General', t: 'g' },
					m: row,
					v: row,
				},
			};
			tableArray.push(cellObj);
		});
	}
);
const luckysheet = useRef(null);

useEffect(() => {
	luckysheet.current = (window as any)?.luckysheet;
	(luckysheet as any).current.create({
		container: 'luckysheet',
		showtoolbar: false,
		showsheetbar: false,
		showinfobar: false,
		showstatisticBar: false,
		sheetFormulaBar: false,
		defaultColWidth: 144,
		defaultRowHeight: 32,
		row: 10,
		data: [
			{
				celldata: tableArray,
			},
		],
		hook: {
			cellUpdated: () => {
				return true;
			},
		},
	});
	setTimeout(() => {
		(luckysheet?.current as any)?.setHorizontalFrozen(false);
	}, 500);
	// eslint-disable-next-line
}, []);

return (
	<div
		id="luckysheet"
		style={{
			margin: '0px',
			padding: '0px',
			position: 'absolute',
			width: '100%',
			height: '100%',
			left: '0px',
			top: '0px',
		}}
	></div>
);

}; `

shahbaazali20 avatar Jun 20 '23 08:06 shahbaazali20