FlexGrid, ListBox mode: Selection is off when creating new row (w/JSFiddle)

Posted by: sverriolsen on 5 March 2019, 4:14 am EST

  • Posted 5 March 2019, 4:14 am EST - Updated 3 October 2022, 8:09 pm EST

    Wijmo version 5.20183.568

    If you create a new row using the ListBox mode the grid selection appears to be moved away from the newly created row, down to the NewRowTemplate row. The Row/RowRange selection modes have the selection appearing on the newly created row, which seems to be the correct behavior.

    http://jsfiddle.net/1cmgz3oL/2/

    The FlexGrid.selection, and the args given to handlers, does appear to be correct, which means this is probably just a visual inconsistency and not an actual breaking bug.

  • Posted 6 March 2019, 2:51 am EST

    Hi,

    Thanks for the detailed description and reproduction sample. We are able to replicate the issue at our end and hence forwarded it to the concerned team for further investigation(Internal tracking Id: 369493). We will let you know about any updates regarding the same. Till then, you may handle the rowAdded event and set the selectedItems property to the correct value as a workaround. Please refer to the following code snippet and the sample demonstrating the same:

    flex.rowAdded.addHandler(function(sender, args){
        	let item = sender.rows[args.row].dataItem;
          sender.selectedItems = [item];
        });
    

    http://jsfiddle.net/47up0cny/

    Thanks for reporting the issue.

  • Posted 8 March 2019, 8:09 am EST

    I went with this:

    flex.rowAdded.addHandler(function (sender, args) {
        if (sender.selectionMode === wijmo.grid.SelectionMode.ListBox) {
            sender.selectedItems = [sender.rows[args.row].dataItem];
        }
    });
    
    
Need extra support?

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

Learn More

Forum Channels