Restricting duplicate data in listbox

Posted by: nivishapanwar on 24 February 2021, 9:57 am EST

  • Posted 24 February 2021, 9:57 am EST

    Hello,

    Can we restrict duplicate value to be added in wijmo listbox?

    addFlag: boolean = false;

    addRecord() {

    this.addFlag = false;

    if (

    this.recordData.indexOf(this.fullname.trim()) == -1 &&

    this.fullname.trim() != “”

    ) {

    this.getWorkflowListItem.forEach((element, index) => {

    if (element.Name == this.fullname.trim() && element.hide) {

    this.getWorkflowListItem[index].hide = false;

    this.getWorkflowListItem[this.index][“Action”] = 0;

    this.tabConfigOptions.push({

    ID: this.getWorkflowListItem.length + 1,

    Rank: 1,

    Name: this.fullname.trim(),

    RollForward: false,

    Action: 0,

    roworder: this.getWorkflowListItem.length + 1

    });

    this.addFlag = true;

    }

    });

    }

    if (!this.addFlag) {

    let id = 1;

    this.getWorkflowListItem.push({

    ID: this.getWorkflowListItem.length + 1,

    Rank: 1,

    Name: this.fullname.trim(),

    RollForward: false,

    Action: 0,

    roworder: this.getWorkflowListItem.length + 1

    });

    this.tabConfigOptions.push({

    ID: this.getWorkflowListItem.length + 1,

    Rank: 1,

    Name: this.fullname.trim(),

    RollForward: false,

    Action: 0,

    roworder: this.getWorkflowListItem.length + 1

    });

    this.recordData.push(this.fullname);

    this.name = new CollectionView(this.recordData);

    }

    this.showCheckboxes = true;

    this.saveListBoxData();

    this.fullname = “”;

    }

    Thank you.

    Regards,

    Nivisha

  • Posted 25 February 2021, 3:12 am EST

    Hi Nivisha,

    Add item functionality is not part of the default functionality, to add new item you need to write additional code so you may add any condition according to your requirement before adding the item to the Listbox.

    If you are facing any issues, then please share a working sample that replicates the issue so that we could investigate it.

    Regards

    Sharad

Need extra support?

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

Learn More

Forum Channels