How use filter on the columns com ReactJS?

Posted by: grazielleconceicao on 21 March 2022, 2:47 pm EST

    • Post Options:
    • Link

    Posted 21 March 2022, 2:47 pm EST

    Hello!

    I need use filter in some columns, i’m use this code with the framework ReactJS, but o filter not function, only add the icon next to name the column.

    
    const filter = new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(-1, 0, 0, 1));
    sheet.rowFilter(filter);
    
    

    Where i’m wronging?

  • Posted 22 March 2022, 3:06 am EST

    Hi Grazielle,

    We tested the rowFilter and it seems to be working fine at our end.

    Please refer to the sample that I have created for you: https://jscodemine.grapecity.com/share/s7ieHXgrm0W9YpYcfO9cfA/

    Row Filter API: https://www.grapecity.com/spreadjs/docs/latest/online/SpreadJS~GC.Spread.Sheets.Worksheet~rowFilter.html

    Please let us know if we are missing any steps or you need further assistance.

    Regards

    Ankit

  • Posted 22 March 2022, 8:22 am EST

    I saw that you used a loop to set values ​​in the worksheet. But, I’m using it another way. My code:

    
    <SpreadSheets
    	hostStyle={hostStyle}
    	workbookInitialized={spread => setSpread(spread)}
    	name="Sheet"
    >
    	<Worksheet dataSource={dataSheet} autoGenerateColumns={false} name="Test+">
    		{array?.map(item => (
    			<Column
    				dataField={item.name}
    				width={120}
    				key={`column-fixed-${item.id}`}
    			/>
    		))}
    	</Worksheet>
    </SpreadSheets>
    
    

    I create a spreadsheet and insert the columns. I pass the values ​​to the worksheet through the DataSource of the WorkSheet. How does the filter work differently?

  • Posted 23 March 2022, 8:43 am EST

    Hi Grazielle,

    We tested out with the Columns inserted and passing the values to the worksheet through the dataSource and the filter is working fine as expected.

    Please refer to the following sample that I have created for you: https://jscodemine.grapecity.com/share/ddH6RmCco06FS46wWfKa9Q/

    Please let us know if we are missing any steps. If the issues still persists for you, please share a working sample so that we can investigate it at our end and assist you accordingly.

    Regards

    Ankit

  • Posted 23 March 2022, 2:00 pm EST

    Hi!

    I see that the filter doesn’t work if the cells are blocked. There is no way to use it with the cell blocked and make the filter work?

    Another question, how to start the checkbox of a cell with the value true?

  • Posted 24 March 2022, 5:46 am EST

    Hi Grazielle,

    You can make the filter work when the sheet is protected by setting the sheet.options.protectionOptions.allowFilter to true.

    Regarding your second question, you can start the checkbox of a cell with the value true by setting the cell value to true at the time of initialization.

    Please refer to the following sample that I have created for you that covers both the above mentioned scenarios: https://jscodemine.grapecity.com/share/vnZxUR_wOU_EtAWXsq40bw/

    Protect WorkSheet and Lock Cells: https://www.grapecity.com/spreadjs/docs/latest/online/celllock.html

    Please let us know if you face any further issues.

    Regards

    Ankit

  • Posted 24 March 2022, 9:47 am EST

    Hi!

    This now worked for me.

    Thanks!!

Need extra support?

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

Learn More

Forum Channels