Removing the focus from wijmo listbox after deleting selected data from listbox

Posted by: nivishapanwar on 29 January 2021, 8:05 am EST

    • Post Options:
    • Link

    Posted 29 January 2021, 8:05 am EST

    Hello,

    After deleting the selected record, record is getting deleted from listbox but after deletion the focus is still on another record of listbox, and if we click on delete automatically records are getting deleted. How can i stop this as according to my project record should be selected first from listbox then it will reflect in textbox , then after clicking on delete it should be deleted.

    removeRecord() {

    let lb = this.ListData.collectionView;

    lb.items.splice(this.ListData.selectedIndex, 1);

    lb.refresh();

    this.fullname = “”;

    }

    for displaying in textbox

    displayListBoxValueInTextField(listBox) {

    this.fullname = listBox.selectedValue;

    this.isOkDisabled = false;

    this.isDisabled = true;

    }

    Attached file for UI.

    Thank you.

    Regards,

    Nivisha

  • Posted 1 February 2021, 2:53 am EST

    Hi Nivisha,

    After calling the refresh method, you may set the selectedIndex property of the Listbox to -1.

    removeRecord() {
    let lb = this.ListData.collectionView;
    lb.items.splice(this.ListData.selectedIndex, 1);
    lb.refresh();
    this.ListData.selectedIndex = -1;
    this.fullname = "";
    }
    

    Regards,

    Ashwin

  • Posted 1 February 2021, 3:40 am EST

    Thank you Ashwin. It’s working as expected now.

    Regards,

    Nivisha

Need extra support?

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

Learn More

Forum Channels