After adding a record in wijmo listbox , textbox is not getting cleared

Posted by: nivishapanwar on 15 March 2021, 10:55 am EST

    • Post Options:
    • Link

    Posted 15 March 2021, 10:55 am EST

    Hi,

    I am using wijmo listbox . I am adding new record to listbox after entering it into a textbox, but after adding the record the textbox is not cleared up.

    I have tried giving this.fullname = ‘’ ,this.fullname = “”, this.fullname = ’ ’

    But nothing is working .

    How can i resolve this.

    fullname: string;

    addRecord() {

    let item = this.recordData.find(cntry => cntry == this.fullname);

    console.log(item);

    if (!item) {

    this.recordData.push(this.fullname);

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

    }

    else {

    this.onShowAlertMessage(AlertType.danger_type, ‘Duplicate data cannot be added’);

    }

    }

    input type=“text” [(ngModel)]=“fullname”

    style=“width: 540px; height: 30px; margin-left: 30px;”>

     

    <wj-list-box #ListData [itemsSource]=“name” (initialized)=“initListBox(ListData)”

    [checkedMemberPath]=“showCheckboxes ? ‘checked’ : ‘’”

    (selectedIndexChanged)=“displayListBoxValueInTextField(ListData)”>







    <input *ngIf=“ListData.checkedMemberPath” type=“checkbox” tabindex=“-1” />



    {{item}}















    Thank you.

    Regards,

    Nivisha

  • Posted 16 March 2021, 6:48 am EST

    Hi Nivisha,

    Are you using the OnPush change detection strategy in your component? If you are, then simply updating the fullName will not work. You will need to manually detect the changes by getting the reference of the ChangeDetectorRef.

    https://stackblitz.com/edit/angular-9-0-0-rc-1-el3xsv

    Regards,

    Ashwin

Need extra support?

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

Learn More

Forum Channels