Wijmo flexsheet - insertRows method appends rows before last row

Posted by: guy.g on 20 August 2018, 9:36 pm EST

    • Post Options:
    • Link

    Posted 20 August 2018, 9:36 pm EST

    Even though I specify the index to were to append new rows, FlexSheet adds it before the last row

    If I have a sheet with 4 rows, and I want to add 196 more rows to it starting index 4 (meaning without changing existing rows place) I write:

    flexSheet.insertRows(4, 196)
    

    But I see that 196 rows were added before the last existing row.

    What am I missing here?

  • Posted 21 August 2018, 5:27 pm EST

    Hi,

    The observed behaviour is by design, insertRows method works just like excel insertRow i.e inserting a row above the specified index.

    In this case, where there are 4 rows max allowed index value is 3, so when you specify any value greater than 3, flexsheet automatically clips it to 3 and hence the row is inserted above the last row.

    If you want to insert rows after the last row then you may use collectionView’s addNew() method in case of bound sheets and push new row instances on flexsheet.rows collection in case of the unbound sheet.

    Please refer to the following sample which implements the same:-

    https://stackblitz.com/edit/js-1ewpzn?file=index.js

    ~Sharad

  • Posted 22 August 2018, 3:17 am EST

    Thank you very much for the quick answer!

    That was exactly what I was looking for

  • Posted 22 August 2018, 5:58 pm EST

    I tried using the same methods for appending columns to the end, but it seems like this is a bit buggy. I looks like it moves some existing cells forward to the next column.

    I don’t really understand why, I am just adding new columns to the columns array. Am I missing something here? Is there a different method of appending columns after the last column?

  • Posted 23 August 2018, 4:37 pm EST

    Hi,

    We are indeed sorry but we are unable to replicate the issue at our end.

    Pushing new column on columns collection seems to be working fine.

    Here is the sample we used for testing:-

    https://stackblitz.com/edit/js-tav9nb?file=index.js

    Please have a look at the sample and let us know if we need to change something to replicate the issue.

    ~Sharad

  • Posted 25 August 2018, 8:23 pm EST

    Yeah, it seems to work fine in you example, I will try it and if I see another issue I will inform you guys.

    Thanks

Need extra support?

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

Learn More

Forum Channels