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

Listview Query items

How can I apply a query to ListView like on DropDownList?

The below function (used from the cascading GropDownList example) works fine ob DropDownLists, but does not work for ListViews, altought ListView object has the same references. The data does not get filtered or updated.


function onSectionChange() {
pageObj.current.query = new Query().where('sectionID', 'equal', sectionObj.current.value);
pageObj.current.enabled = true;
pageObj.current.text = null;
pageObj.current.dataBind();
}


3 Replies

LD LeoLavanya Dhanaraj Syncfusion Team April 20, 2023 03:03 PM UTC

Hi Mehdi,


Greetings from Syncfusion support.


Based on the shared details, we understand that you want to filter list data using a query in the React ListView component. Accordingly, we have prepared a sample for your reference, which is included in the latest version (21.1.41). With this implementation, the ListView component can display filtered data based on user inputs, using the DataManager.


Sample : https://stackblitz.com/edit/react-utgtm5?file=index.js


Also, check out the below documentation link for achieving the ListView filtering on React platform.


https://ej2.syncfusion.com/react/documentation/listview/how-to/filter-list-items-in-the-listview


Note : In this sample, list data has been filtered with starting character of the list items. You can also filter list items with ending character by passing the endswith in where clause instead of startswith.


Regards,

Leo Lavanya Dhanaraj



MN Mehdi Nabhani replied to LeoLavanya Dhanaraj April 20, 2023 04:39 PM UTC

Thank you.



LD LeoLavanya Dhanaraj Syncfusion Team April 21, 2023 04:57 AM UTC

Mehdi, Glad to know your issue has been resolved. Please get back to us in future for further assistance.


Loader.
Up arrow icon