Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Feat/filter complex object #68

Merged
merged 2 commits into from
Sep 20, 2018
Merged

Feat/filter complex object #68

merged 2 commits into from
Sep 20, 2018

Conversation

ghiscoding
Copy link
Owner

In certain cases, our dataset might contain properties that are complex objects. This PR adds the possibility to filter correctly these complex objects.

For example, let say that we have this dataset

const dataset = [
 { item: 'HP Desktop', buyer: { id: 1234, address: { street: '123 belleville', zip: 123456 }},
 { item: 'Lenovo Mouse', buyer: { id: 456, address: { street: '456 hollywood blvd', zip: 789123 }}
];

We can now filter the zip code from the buyer's address using this filter:

this.columnDefinitions = [
  {
    // when the "field" string includes the dot "." notation, the library will consider this to be a complex object and Filter accordingly
    // so this Field, tells us the child value is "zip" which is under the parent tree "buyer"
    id: 'street', name: 'ZIP', field: 'buyer.address.zip',
    filterable: true,
    filter: {
      model: Filters.compoundInput
    },
   // ...
];

@ghiscoding ghiscoding merged commit f5ed9f9 into master Sep 20, 2018
@ghiscoding ghiscoding deleted the feat/filter-complex-object branch November 8, 2018 01:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant