Filter

Hello,


I am trying to add some filters on my kanban cards, it works perfectly with my search bar from the documentation.

But my question is how can i implement it with an array of possibilities (ex tags: ['TODO', 'PROGRESS'', 'TOTEST']), I want to add to the filter the cards with the status TODO or PROGRESS and the search.

Thanks you,
Nicolas




3 Replies 1 reply marked as answer

VD Vinitha Devi Murugan Syncfusion Team August 4, 2020 08:47 AM UTC

Hi Nicolas,

Syncfusion Greetings.

We achieved your requirement by using our base library Predicate class to create composite filter criteria. We have prepared a sample below for your reference.



change(args: DropDownChangeArgs): void {
      let value = args.value.split(',');
      //Building complex filter criteria using `Predicate`
        let predicate: Predicate = new Predicate('Status', 'equal', value[0]);
        predicate = predicate.or('Status', 'equal', value[1]);
        let filterQuery: Query = new Query();
        if (args.value !== 'None') {
                filterQuery = new Query().where(predicate);
            }
        this.kanbanObj.query = filterQuery;
    }
    

Kindly try the above code and get back to us if you need any further assistance.

Regards,
M.Vinitha devi


Marked as answer

BN BETBEDER Nicolas August 4, 2020 12:02 PM UTC

Hello,

Thank you for you response.

And if I want to search on the filtered cards do I also have to use the predicate?

 new Query().where(predicate).search(predicate_search);

Can we create query like this?

Thank you,
Nicolas


VD Vinitha Devi Murugan Syncfusion Team August 5, 2020 07:52 AM UTC

Hi Nicolas,

Thanks for your update.

No, in search method we can not use predicate. Within the second argument of the search method you can search for composite criteria using field name collections instead of predicate. We have prepared a sample below for your reference.


let value = args.value.split(',');
      //Building complex filter criteria using `Predicate`
        let predicate: Predicate = new Predicate('Status', 'equal', value[0]);
        predicate = predicate.or('Status', 'equal', value[1]);
        let filterQuery: Query = new Query();
        if (args.value !== 'None') {
                filterQuery = new Query().where(predicate).search("L", ['Id', 'Summary', "Priority"], 'contains', true);
            }
        this.kanbanObj.query = filterQuery;

Kindly try the above sample and get back to us if you need any further assistance.

Regards,
M.Vinitha devi




Loader.
Up arrow icon