Get the current flexgrid grid

Posted by: a.luis on 8 September 2022, 12:13 am EST

  • Posted 8 September 2022, 12:13 am EST

    How to get the current flexgrid from GridId without creating anew one?

    I'm trying to determine the actual selected row count in OutSystems and I'm using this function:

    function showCheckedCount(gridID) {
    const grid = new wijmo.grid.FlexGrid(gridID, {});
    sel = grid.rows.filter(r => r.isSelected);
    cnt = sel.length;
    return cnt;
    }


    But the grid already exists and so I'm getting an error.

    Can someone help?
  • Replied 8 September 2022, 2:21 pm EST

    Hi Andi,

    You can use the getControl() method to get an already existing control instance by passing the DOM element that hosts the control, or a CSS selector for the host element. You may use the code snippet below to get the selected row count from grid element's id:

    function showCheckedCount(gridID) {
    const grid = wijmo.Control.getControl(gridID),
    cnt = grid.selectedRows.length;
    return cnt;
    }

    API link: https://www.grapecity.com/wijmo/api/classes/wijmo_grid.flexgrid.html#selectedrows

    Regards
  • Marked as Answer

    Replied 13 September 2022, 8:53 pm EST

    I used a setInterval and called the function to count rows. It worked
Need extra support?

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

Learn More

Forum Channels