Influence other multi-select controls through the previous multi-select control?

Hi 

 

Question 1 :

     Manipulate the current control to affect the value of another control. In another control, although the last value has changed, the page has not been refreshed.

https://stackblitz.com/edit/angular-zqv1jm?file=src%2Fapp.component.ts


Image_5209_1708585380995


Question 2:

             When I place the multi-select control in a loop, the ID cannot be set at this time, so how do I refresh the specified multi-select control?

  

Image_7268_1708586955260

Image_8407_1708586968212



1 Reply

YS Yohapuja Selvakumaran Syncfusion Team May 13, 2024 05:57 AM UTC

Hi aquan,



Thank you for your patience, and we apologize for the delay in our response. We've addressed your queries and provided solutions for both.


Query 1: Manipulate the current control to affect the value of another control. In another control, although the last value has changed, the page has not been refreshed.



Regarding manipulating one control to affect another control's value and refreshing the page when the value changes, we have resolved the issue using the clone method. Please refer to the modified sample below for further clarification:



Code Snippet:


 

delete() {

    var clone = [...this.value1];

    clone.splice(01);

    this.value1 = clone;

    console.log(this.value1);

    this.multiselect3.refresh();

  }

 

 



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



Query 2: When I place the multi-select control in a loop, the ID cannot be set at this time, so how do I refresh the specified multi-select control?


For placing the multi-select control in a loop and setting the ID dynamically, we have addressed the issue by refreshing each multi-select based on the index. Please review the modified sample below:



 

public onMultiselectCreated(

    multiselect: MultiSelectComponent,

    index: number

  ): void {

    this.multiSelects.toArray()[index] = multiselect;

  }

 

  // Method to refresh for the specified Multiselect

  public showPopup(index: number): void {

    this.multiSelects.toArray()[index]?.refresh();

    alert('MultiSelect' + ' ' + index + ' ' + 'refreshed');

  }

 

 



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



We hope these solutions address your concerns. If you have any further questions or require additional assistance, please feel free to reach out to us.





Regards,

Yohapuja S


Loader.
Up arrow icon