Flexgrid Formula

Posted by: grapecity on 27 October 2017, 6:13 pm EST

    • Post Options:
    • Link

    Posted 27 October 2017, 6:13 pm EST

    1. How can I programatically enter the formua to calculate the sum of a row. For example, I want to calculate the sum on row 3, start from column 4 to column 12 and store the result into cell on row 3, column 3.

    2. How do I enter the formula into row 3, column 3 of flexgrid1 and set it equal to row 5, column 5 of flexgrid2

    3. Where can I find the reference table of all formula support on flexgrid?

    Thank you very much.

  • Posted 29 October 2017, 3:28 pm EST

    Hi Hoang,

    We are sorry, FlexGrid does not support formula. If you would like to use built-in formula support, you may go with FlexSheet control.

    http://demos.wijmo.com/5/angular/FlexSheetIntro/FlexSheetIntro/

    However, you can define function and use them using wjFlexGridCellTemplate to view only. If you would like to replace the data, you need to set the data using setData for the cell.

    ~Manish

  • Posted 30 October 2017, 12:51 am EST

    Can we write custom formula sir?

  • Posted 30 October 2017, 12:54 am EST

    If yes, do you have any sample code?

  • Posted 30 October 2017, 5:20 pm EST

    Hi Hoang,

    If we are correct, you are looking for custom formula in FlexSheet control. If yes, you may use addFunction method for the same.

    Please refer to the following demo sample for the same:

    http://demos.wijmo.com/5/Angular2/FlexSheetExplorer/FlexSheetExplorer/#/customFunction

    ~Manish

  • Posted 31 October 2017, 12:32 am EST

    No sir,

    Per your previous reply, I am looking for " … define function and use them using wjFlexGridCellTemplate …". I am writing an app in ionic 3 using Flexgrid. Is there a way I can write my own custom function or use an available function that built in with Flexgrid? Thank you sir very much.

  • Posted 31 October 2017, 12:47 am EST

    What I am looking for is a way to calculate Sum of a range in the row, such as (row c1, col 2, row1, col 10) and store this Sum into cell (row 1, col 15). I have tried to write a for loop that compute total and setCellData(1, 15, total, false, true). I need to calculate this sum when the grid is first loaded, and each time user changes the cell value. For each time user changes cell value, I calculate sum of current row with event keyDown. For initial grid loading, I compute sum of every row in formatItem event. This slow down on performance. I am looking for a formula embedding or any method to improve performance.

  • Posted 31 October 2017, 4:32 pm EST

    Hi Hoang,

    As I mentioned in the original reply, FlexGrid does not support formula. The method suggested to you is just a workaround.

    You should compute the Sum in the loadedRows or initialized event. This should improve performance.

    You also need to recall method in cellEditEnding event. The reason for poor performance is computing the sum in formatItem and keyDown event.

    Please share a demo sample for the same so that we can suggest accordingly if the issue persists.

    ~Manish

  • Posted 1 November 2017, 8:22 am EST

    Thank you Manish. I follow your advice by calculate Sum of a range in the row in cellEditEnded event. This improve performance a lot. The next question I have is:

    User may enter the cell, change value, press tab to navigate next adjacent cell, change value, hit tab to next adjacent cell to edit. In short, user may edit 10 cells next to each other in a row in a few seconds. Is there a way I can pause my calculation until last cell Edited complete then call calSum routine? Thank you sir very much.

  • Posted 1 November 2017, 2:45 pm EST

    Hi Hoang,

    Yes, you can calculate on row change using rowEditEnded event. This event gets triggered when row exit from edit mode.

    ~Manish

  • Posted 2 November 2017, 12:26 am EST

    Thank you Manish

Need extra support?

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

Learn More

Forum Channels