Our blazing fast Grid component built with pure JavaScript


Post by janan »

https://www.bryntum.com/examples/grid/filterbar/
In the above examples, I changed

features : {
        filterBar : { filter : { property : 'age', value :!0, type: 'number' } },
        stripe    : true,
        quickFind : true
    }

I have also changed some values in column age to zero. I want to filter out values that are zero by default.
Can you please help? Kindly let me know if you need more clarity!

Attachments
Screen Shot 2020-09-09 at 11.13.47.png
Screen Shot 2020-09-09 at 11.13.47.png (49.76 KiB) Viewed 2260 times
Last edited by janan on Wed Sep 09, 2020 11:20 am, edited 2 times in total.

Post by fabio.mazza »

Hi janan,

For the filter, on "value" property, you can not use logical value(!0), but only value.

If you want to have default to filter all records that doesn't have age "0", you can use https://www.bryntum.com/docs/grid/#Core/util/CollectionFilter#config-operator config to define it. For example:

filterBar : { filter : { property : 'age', type : 'number', operator : '!=',  value : 0 } },

Now, if you want to filter all records with age "0" by default, you can do this:

filterBar : { filter : { property : 'age', type : 'number', operator : '=',  value : 0 } },

I hope this help you. Please let me know if you have any question.

Best regards,
Fabio


Post by fabio.mazza »

PS: When create posts, please use the button "Code display (code brackets)" available on editor to post your code to be better to read it:

Screen Shot 2020-09-08 at 10.55.43.png
Screen Shot 2020-09-08 at 10.55.43.png (7.59 KiB) Viewed 2265 times

I already fixed on your post. Thank you!

Best regards,
Fabio


Post by janan »

Hi again,
Thanks for above response.
I changed the code as following in above same example :

filterBar  : { filter : { property : 'city', operator: '!=', value : 'Paris' } },

I do not get the filtered options in the filterbar. I have attached screen shot in the question.
Can you please help with it?


Post by fabio.mazza »

janan,

Your code above and your screenshot are correct and is working fine, that is expected. Your store is bringing all records with all cities, except records with city "Paris" and if you want all records with city different of Paris, doesn't makes sense the "Paris" value be shown on your filter bar because you are filtering to be different, not equal.

Best regards,
Fabio


Post by fabio.mazza »

PS: Please keep your attachment on your answer related, not on your first message post, to be a correct reference for the message/question.

Best regards,
Fabio


Post by janan »

Sure and thanks for the quick response.

filterBar : { filter : { property : 'age', value : '30',operator: '>' } },

.
In the same example with above code change, I get all values greater than 30. But i will have it highlighted some where like in screenshot and will also have an option to clear the filter.
Kindly let me know if it is not clear :)

Attachments
Screen Shot 2020-09-09 at 13.55.09.png
Screen Shot 2020-09-09 at 13.55.09.png (128.38 KiB) Viewed 2254 times

Post by fabio.mazza »

janan, I have created a feature request to show the operator on filter bar: https://github.com/bryntum/support/issues/1493

Best regards,
Fabio


Post by fabio.mazza »

To clear the filter bar field, you can search on forum, there are some posts about, like this: viewtopic.php?p=76547#p76547

Best regards,
Fabio


Post Reply