Get Unchecked Value

Hi,   Is there possible to get ejs-multiselect dropdown unchecked values, while the dropdown is opened.


1 Reply

MR Mallesh Ravi Chandran Syncfusion Team July 31, 2023 02:44 PM UTC

Hi Siddiq , 

We are pleased to inform you that it is possible to retrieve the unchecked values in the dropdown while it is open. We have a solution for you to achieve this requirement. We have prepared a sample for your reference that demonstrates how to obtain the unchecked values during the dropdown's open event. 


[app.Component.html] 

<ejs-multiselect

        #checkbox

         ...

        (open)="onOpen($event)"

        (change)="onChange($event)"

        ...

      ></ejs-multiselect>

 

 

[app.Component.ts] 

 

 

public selectedItemsstring[] = [];

 

public onOpen(): void {

    const dataSource = this.mulObj.dataSource as { [keystring]: Object }[];

    const uncheckedItems = dataSource.filter(

      (item=> !this.selectedItems.some((code=> code === item.Code)

    );

    const uncheckedItemNames = uncheckedItems.map(item => item.Name);

    //Get the uncheckedItemNames

    console.log('Unchecked items:'uncheckedItemNames);

  }

  public onChange(args): void {

    // Get the checked values

    this.selectedItems = args.value;

  }

 


Sample : https://stackblitz.com/edit/angular-zqd9my-vpoju7?file=src%2Fapp.component.ts,src%2Fapp.component.html


API Reference : https://ej2.syncfusion.com/angular/documentation/api/multi-select/#open


Regards,

Mallesh


Loader.
Up arrow icon