Flexsheet Sort by column with empty strings

Posted by: chris on 6 December 2017, 4:58 am EST

    • Post Options:
    • Link

    Posted 6 December 2017, 4:58 am EST

    I have attached an image of the flexsheet in question below. I am sorting Ascending in the first column labeled “Full Serial Number”. The cells that are blank in that column contain an empty string. Is there a way to omit the rows which are blank and contain the empty string during the sort process so that only the ones containing text will be sorted and will appear towards the top of the sheet instead of at the very bottom? I am using PureJS so if you provide the code, please use pure JS. Thank you?

  • Posted 6 December 2017, 11:14 pm EST

    Hi Chris,

    I would like to confirm if the sheet you are using is bound sheet or unbound sheet. The FlexSheet with bounded sheet do not includes null values in sorting with the latest build 5.20173.380.

    Please refer to the fiddle for the same:

    http://jsfiddle.net/db4jj1cj/12/

    If the issue persists, please modify the sample for investigation.

    ~Manish

  • Posted 13 December 2017, 2:04 am EST

    Mansih,

    Thank you, adding NULL values prevented the incorrect sort and the sort works better now. However, there is a new separate problem. I have a frozen TOTALS row that I manually added to the top row which works fine until you apply the sort then it gets wiped out. See code below and screenshot of what it looks like before and after sort. How can I prevent the 1st row from being affected by the sort?

    sheet.rows.unshift(new wijmo.grid.Row());
    sheet.setCellData(0, 0, 'Column Totals:');
    sheet.setCellData(0, 2, '=Sum(C2:C499)');
    sheet.setCellData(0, 3, '=Sum(D2:D499)');
    
    sheet.applyCellsStyle({
        fontSize: '13px',
        fontWeight: 'bold',
        verticalAlign: 'middle',
        backgroundColor: '#E1EFEF',
        color: '#000000',
        textAlign: 'right'
    }, [new wijmo.grid.CellRange(0, 0, 0, 3)]);
    

    sheet.frozenRows = 2;

  • Posted 13 December 2017, 5:39 pm EST

    Hi Chris,

    You may add ColumnFooters to show aggregate for Columns. If you would like to add the row at the top, you need to add the rows in updatedView event.

    Please refer to the fiddles for the same:

    Adding ColumnFooter to the FlexSheet:

    http://jsfiddle.net/db4jj1cj/13/

    Adding row at the top:

    http://jsfiddle.net/db4jj1cj/14/

    ~Manish

Need extra support?

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

Learn More

Forum Channels