How to retrieve changed values in table?

Posted by: grazielleconceicao on 15 March 2022, 10:50 am EST

    • Post Options:
    • Link

    Posted 15 March 2022, 10:50 am EST

    I have a function to get the changed values ​​in the table. However, it’s returning me empty, I can’t at all get these changed values. I’m usign ReactJS.

    
    function handleClick() {
        const element = new GC.Spread.Sheets.Worksheet(name);
        const sheet = element.getActiveSheet();
        const dirtyCells = sheet.getDirtyCells();
        console.log('dirtyCells', dirtyCells)
    }
    
    return(
    <SpreadSheets hostStyle={hostStyle} workbookInitialized={spread => initSpread(spread)}>
            <Worksheet dataSource={data} autoGenerateColumns={false}>
              <Column dataField='Film' width={150}></Column>
              <Column dataField='Genre' width={150}></Column>
              <Column dataField='Lead Studio' width={80}></Column>
              <Column dataField='Audience Score %' width={150}></Column>
              <Column dataField='Profitability' width={80}></Column>
              <Column dataField='Rating'></Column>
              <Column dataField='Worldwide Gross'></Column>
              <Column dataField='Year'></Column>
            </Worksheet>
          </SpreadSheets>
    )
    
  • Posted 16 March 2022, 12:50 am EST

    Hi,

    As I can see, you are creating a sheet instance using new GC.Spread.Sheets.Worksheet(name); but again using getActiveSheet() on the sheet instance. This won’t work.

    You can get the spread instance when the workbook is initialized using the workbookInitialized method.

    Get the sheet instance using spread.getActiveSheet() or spread.getSheet() methods. Using getDirtyCells will work then.

    You can refer to the attached sample that I have created for you: https://jscodemine.grapecity.com/share/AT6jVH4gQkOvIBgM3dVt0g/

    getActiveSheet method: https://www.grapecity.com/spreadjs/docs/latest/online/SpreadJS~GC.Spread.Sheets.Workbook~getActiveSheet.html

    getSheet method: https://www.grapecity.com/spreadjs/docs/latest/online/SpreadJS~GC.Spread.Sheets.Workbook~getSheet.html

    Demo on getting started with React: https://www.grapecity.com/spreadjs/demos/quickstart/quickstart-react

    Please let us know if you face any further issues.

    Regards

    Ankit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels