Ag-Grid 'agSetColumnFilter' Customization - filter

Can i change the default behaviour of agSetColumnFilter of ag-grid. I can change the filter values by using values: paramter in filterParams. But Since Set Filter performs exact serarch with cell Value so can i update it to Contains search instead of Exact Search.

Yes, you can do it. Under column definition.
{
filter: 'agSetColumnFilter',
filterParams: {
values: ["custom1", "custom2"]
}
Also read about [https://www.ag-grid.com/javascript-grid-server-side-model-filtering/#example-set-filter] to load the values Async.

No, that's not supported. The whole point of the agSetColumnFilter is to match a (hopefully) small set of values contained in a column. If you have so many different values that you need a 'contains' filter, then the setFilter is probably not appropriate anyway.
That said, if you want custom behavior in a filter, that is not accommodated by a standard filter your best is probably to write your own custom filter. The documentation for custom filters can be found at https://www.ag-grid.com/javascript-grid-filter-component/#custom-filter-example

Related

How to add multiple fields for sorting top hits in ElasticSearch Java API?

I know that ES supports sorting top hits by more than one fields, like sort: ["_score", "datetime"] suggested by this post: https://discuss.elastic.co/t/top-hits-query-with-same-score/107018
But how to do it using Java API?
The AggregationBuilders.topHits().sort() only receives one field as parameter.
Should I use
and SortBuilder as parameter?
If so, SortBuilder asks for a QueryShardContext parameter, which I don't know how to create. I have never used it before. None of the other requests uses this QueryShardContext.
Is there any simple way to do it, like, just pass in an array of fields into sort()?
Thanks in advance!
There are overloaded TopHitsAggregationBuilder.sort() methods, namely one that takes String name, i.e. the name of a field, so you can do it like this:
TopHitsAggregationBuilder thabuilder = AggregationBuilders.topHits("top");
thabuilder.sort("datetime", SortOrder.DESC);
thabuilder.sort("field2", SortOrder.ASC);
...
All the sort calls will add a new sort component to the top-hits aggregation.

clarity filter does not work with multiple values

Clarity Filter doesn't work with multiple values on random search
Please find an attachment
Filter Example
Regards,
Rupali Jain
The default built-in string filter is a simple string matcher, and that is explained in the documentation. For something more complex, you have to build this yourself with a custom filter. Often I have seen people build a custom filter with a list of checkboxes for the values in the field (such as none, data, etc) that can be applied in a search. See the custom filter documentation for details and demo of how to build your own.
https://v1.clarity.design/datagrid/custom-filtering

Laravel - Model binding not working when I use accessors

I want to populate my select box from the Laravel IoC Container.
App\Http\Utilities\BillingHelper.php
views/billing/create.blade.php
views/billing/edit.blade.php
Create the table:
Now, instead of the value, i want to display some flags and currency symbols.
Should i use mutators?
Problem
If i use mutators, when i open the edit page, i see always the first value selected, from the BillingHelper, instead of the choosen one.
Any help? Thanks.
I know it should be a comment, but I have no reputation.
What if, on you edit page, you replace null on Form::select with $client->language and $client->currency.
I know that you area binding the values with Form::Model. But worth a try.
When you use mutators the matching won't occur anymore. You'll have to use a matching static array according to the values you'll return. (the flags)
You can make it work if you make a mutator for saving the data also and simplify again to the ['it', 'en', 'lv'], otherwise your saved data will differ and the initial mutator won't work the second time. You can still make a one-time-only test.
This is why:
Your form binding is using $bill->language to retrieve the actual stored data, and compare it with the values in your $bill::lang static array. If no match found, than the first value will be always selected.
Can you provide the the currency and language fields definition in the migration for the bill?
Also retrive your values from your bills DB and paste them here for language and currency. They must be in the defined static sets.
Laravel has a way of skipping the accessor/mutator by using
$model->getOriginal('data_field').
The "getOriginal()" gets the model's original attribute values.

Should specific filters be expressed as an explicitly named field, or a generic field with a filter param?

When expressing data filters, via GraphQL, should we be creating explicitly-named fields for that filter or should we be adding a parameter to a more generic list-type field that would apply the filter?
For example, if I've got a field called teams but I want to provide the ability to filter the data, provided by teams, down to only the teams who are active (versus inactive), should I expose that filter via GraphQL as a param on the teams field, or should I create a new field called activeTeams?
I'm thinking the clearly, explicitly named fields might scale better and be less confusing in the long run because there won't be questions about how params works when paired with each other, etc.
I wanted to get feedback on how maybe Facebook approaches this, or how others are doing so.
You should add the filter as a param on the teams field as this is the more scalable approach. Introducing a new filter means only a single parameter needs adding. Whereas the multiple-fields approach requires an exponential number of fields for each possible combination.
Don't forget that you can also alias fields on the client if you wish to fetch multiple queries of teams within the same component:
query on Viewer {
activeTeams: teams(active: true) { ... }
inactiveTeams: teams(active: false) { ... }
}

Symfony2 validation filters

In my Symfony 2 application I need to filter input before passing it on to validation [1], however, I can't seem to find any system within Symfony to do this.
The type of filtering I looking for is e.g. to be able to filter a dash out of a specific field before validating it. E.g. users can enter 123-123 but the only accepted value is 123123. Just as I can set up validation rules with constraints, I'm looking for something similar for filters.
[1] http://symfony.com/doc/current/book/validation.html
Nifr's answer is good but is missing of an important alternative that, if I understand correctly your question, seems to fit perfectly your needs.
You can use a hook that is pretty much an event listener: if something happens or is going to happen, it intercepts the event and redirect it to your function.
In this case, you need a PRE_BIND hook (is deprecated since 2.3 version, now it's called PRE_SUBMIT)
Read this if you need help about
Either write your own Validation Assert to filter and then proxy the other validators for this purpose ...
... or one or multiple Regex Asserts.
... or use a DataTransformer to transform/filter the input.
With the DataTransformer involved you could aswell consider creating a new FieldType which renders two inputs with a seperator like the date form-field does. ( if not not used with widget => single_text )

Resources