FLexgrid initialization

Posted by: maheswar.nallacharu on 15 January 2022, 1:10 am EST

  • Posted 15 January 2022, 1:10 am EST

    I’m using angular 8 with wijmo grid. I’m facing issue to get selected row.

    It worked fine when data is assigned from type script but it didn’t work when

    I assigned data via http call where it takes time to load data. I assumed that

    this is happening because the grid is not getting loaded till data is assigned

    and some properties are not available.

    I’m getting following error

    selectionChanged is undefined for this line

    flexInitialized(flexgrid: wjGrid.FlexGrid) { // in html its (initialized)

    console.log(“on change”);

    flexgrid.selectionChanged.addHandler(() => {

    if (flexgrid.selection.isSingleCell) {

    let r:wjGrid.CellRange = flexgrid.selection;

    What are my options here so that I can get selected row/data ?

  • Posted 17 January 2022, 4:13 am EST

    Hi,

    Please refer to the following demo sample to handle the Initialized and the SelectionChanged event for Wijmo FlexGrid in Angular.

    https://www.grapecity.com/wijmo/demos/Grid/Selection/Overview/angular

    Hope it helps!

    Regards,

    Manish Gupta

  • Posted 18 January 2022, 2:06 am EST

    I’m more interested to see code where data grid is getting assigned using htttp call where there is quite delay while data is getting assigned. For this case, its not working and I need to know if there is something to know if grid is initialized completely and only then I want to assign event handler like selection

  • Posted 18 January 2022, 10:14 pm EST

    Hi Maheshwar,

    In the simple data assigning, the data is set to the FlexGrid as the Grid is initialized completely.

    For delayed/http call data assigning, the selection is set before assigning the data and when the data is assigned, the selectionChanged event does not gets triggered.

    To get the selection, we may handle the updatedView event and check the FlexGrid update with flag variable and log the selection as the flag value is 2 after assigning the data.

    Please refer to the following code snippet for reference:

    private _flag = 0;
      initGrid(flex, e) {
        flex.updatedView.addHandler((s, e) => {
          this._flag++;
          if (this._flag == 2) {
            console.log("updated");
            console.log(s.selection)
          }
        })
      }
    

    Regards,

    Manish Gupta

  • Posted 18 January 2022, 11:16 pm EST - Updated 3 October 2022, 3:09 am EST

    Thanks Manish, it worked with this approach.

    For css related I’m facing issue. Parent app is using wijmo and it has support to use use wijo to extend functionality. I’m able to get tree grid working but when I ran it as individual app its looks fine but in main app somehow it looks little bit different. I assume that some css is not getting applied. For more reference pfa screen shot and let me know your input on this.

  • Posted 20 January 2022, 12:38 am EST

    Hello,

    We appologize but we are unable to replicate the issue at our end, could you please provide a minimized version of your application replicating the issue? so that we can investigate and assist you accordingly.

    As per the shared image, it seems some other CSS is getting applied to the treeGrid elements, please make sure some other CSS doesn’t get applied to the treeGrid elements.

    Regards

Need extra support?

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

Learn More

Forum Channels