Reputation: 909
I have created one datasource which contains only the rows that fulfil one condition. I want to create some filters in this table... but is not working.
For example, I have a text area which filters by the field "Title". Only should appears the row 5 , but the numer 6 it's still here...
This is the event handler code:
Important: in the beginning, I used this filters and they worked properly. They stopped working when i created the filter in the datasource (The one of the first image)
Upvotes: 2
Views: 1268
Reputation: 343
The filter that you are setting via the binding is getting lost when you perform your query script. Essentially, you are creating a query via the binding, then your script is creating a new query that doesn't have the filters you set previously.
Server Script - queryRecords(query: Query)
You'll notice that your query script has access to a parameter query
that you can use instead of calling newQuery()
. This will have the filter you set via your binding. Additionally, query.run()
returns a list of records, so there's no need to iterate over them. Here is all the code you need in your query script:
query.filters.Status._in = ["Published"];
return query.run();
Upvotes: 2