We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Filter not woking after change datasource

When datasource load the first time, filtering is working. But after I change datasource depends on other component, it didn't work.


2 Replies

IL Indhumathy Loganathan Syncfusion Team November 8, 2022 09:48 AM

Hi Hieu,


Greetings from Syncfusion support.


The reported issue with filtering in the Dropdown Tree component may occur due to the component not being properly refreshed after a data update. To overcome the issue, you can follow the below steps to update the Dropdown Tree data and refresh the component to perform filtering.


//Update the Dropdown Tree data.

onClick() {

var newData = [

    { id: 16, name: 'MP3 Albums', hasChild: true },

    { id: 17, pid: 16, name: 'Rock' },

    { id: 18, pid: 16, name: 'Gospel' },

    { id: 19, pid: 16, name: 'Latin Music' },

    { id: 20, pid: 16, name: 'Jazz' },

    { id: 21, name: 'More in Music', hasChild: true },

    { id: 22, pid: 21, name: 'Music Trade-In' },

    { id: 23, pid: 21, name: 'Redeem a Gift Card' },

    { id: 24, pid: 21, name: 'Band T-Shirts' },

    { id: 25, name: 'Fiction Book Lists', hasChild: true },

    { id: 26, pid: 25, name: 'To Kill a Mockingbird' },

    { id: 27, pid: 25, name: 'Pride and Prejudice' },

    { id: 28, pid: 25, name: 'Harry Potter' },

    { id: 29, pid: 25, name: 'The Hobbit' },

];

this.ddTree.fields = {

    dataSource: newData,

    value: 'id',

    parentValue: 'pid',

    text: 'name',

    hasChildren: 'hasChild',

};

this.ddTree.refresh();

}


Sample: https://stackblitz.com/edit/angular-q6qvfo?file=app.component.html,app.component.ts


Regards,

Indhumathy L



HI Hieu replied to Indhumathy Loganathan November 10, 2022 09:29 PM

Thank for your sample,

I try to follow your sample but when I use filtering don't choose any item in dropdown tree and after that I choose other item in dropdown list which dropdown tree datasource depends on, I got this error message.

Sorry for my bad english.



Loader.
Live Chat Icon For mobile
Up arrow icon