FlexGrid row index -1 on page load

Posted by: peter_murray on 18 December 2019, 4:33 pm EST

    • Post Options:
    • Link

    Posted 18 December 2019, 4:33 pm EST

    Hello,

    We’ve been working with the newest version of wijmo, 5.20193.637, and we noticed an exception being thrown when trying to fire an event through the onSelectionChanged function in me-comps.component.ts, line 158 in the attached project. On page load, it throws an exception and we discovered through breakpoints it was because e.row was equal to -1.

    We then reverted back to the previous version of wijmo to see if this was happening in that version, 5.20183.550, and found that this was not happening.

    Our guess is that the -1 value we’re seeing is a kind of “no row found” response rather than some faulty math operation, but either way, could you please explain this change to us, and what fixes we could use to stop the exception from being thrown?

    Thanks!flexgriddemo.zip

  • Posted 19 December 2019, 3:04 am EST

    Hi Peter,

    The issue is occurring because you are setting the SelectionMode to None in the onGridInit method which calls the select method with (-1, -1) parameter in the latest version and not in the earlier version.

    To resolve this issue, you can add the handler to the selectionChanged event in the loadedRows event handler:

    <wj-flex-grid #compsflex id="tableComponents"
          [itemsSource]="data" 
          class = "theight">
        <ng-template wjFlexGridCellTemplate [cellType]="'RowHeader'" let-cell="cell">					 {{cell.row.index+1}}
    	</ng-template>
    </wj-flex-grid>
    

    onLoadedRows(e?: wjcCore.EventArgs): void

    {

    … this.flex.selectionChanged.addHandler(this.onSelectionChanged.bind(this));

    //console.log(‘leaving onloaded rows’, this.rowToSelect)

    }

    Please refer to the updated sample attached.
    
    Regards,
    Ashwin
Need extra support?

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

Learn More

Forum Channels