Filter state two-way binding, custom equals - #1
Conversation
|
So if I get it right, I should create a new interface which is called SerializableFilter and extends ClrDatagridFilterInterface, and I should create a new implementation as well which will implement this new interface, and i think it can extend the string filter implementation class. In this case we wont affect custom filters like color filter. What about the equals logic, is it fine to you to check the property names? |
You mean to patch the builtin sting filter implementation to implement the new SerializableFilter interface. |
|
@audax The refactor is committed, One thing is different, I don't set the filterstate directly, I just set it by the value setter, and via the constructor. |
|
Memory leak is fixed, now it works fine for built in string filter. |
|
@audax are there any e2e tests (protractor) in the project, is it runned by the pipeline? Or it is enough to make a dedicated page under the datagrid section to demonstrate the usage, with the built in filters, and the custom ones? |
|
All right, I'll prepare demo site, with different filters, and presorted columns, prepaged grid. Is that enough to accept the pull request? |
|
I'm just wondering, how could we restore the state of a custom filter, because it is a content child of the grid, so somehow we have to deliver the state info to the content child, which should implement the SerializableFilter interface, and restore the values in the component. How should we do this, or we should let the user to handle it locally? |
|
It seems, it works now, but we have to identify the filters somehow, we identifies string filters by type and property name, but for custom filters like color filter we also have to use type and id as well, because there can be two different colorfilters on the same grid, so I think we should update FilterStateInterface to include some kind of id beside the type field. |
|
Now the preset for custom filters works, but I still don't know, how to pass an identifier for the custom filters, because we have to differentiate if multiple instance exists of the same type of the custom filter. Given this filter: When this filter is registered in the grid, we cannot access input properties, because they are null, because the filter component is not in that lifecycle to access these fields, so we need something which is available in the constructor, can we get Any idea is welcome. |
|
@Wallabeng helped me with the solution, which was obvious, but I didn't think about that. He sets the custom filter ids in the binding-state component's onInit, not in the HTML. It works perfectly, but that means the user have to pay attention to set it. |
Date interval filter, Number interval filter, List filter Signed-off-by: Daniel Szegvari <extern.daniel.szegvari@porscheinformatik.at>
I may not understand this, could you please show me an example how you use the custom filters? |
Minor refactors, Write new tests, Fix failing tests Signed-off-by: Daniel Szegvari <extern.daniel.szegvari@porscheinformatik.at>
|
Hi @audax . Sorry for the delay. I had a couple of minor refactors, and wrote some tests. Please review it, if you have time. |
Minor refactors Signed-off-by: Daniel Szegvari <extern.daniel.szegvari@porscheinformatik.at>
|
I'm interested in getting this across the finish line -- let me know if there's anything I can help with. Should it be rebased on top of vmware-archive#2846? |
Here is a working version of the filter two-way binding, it's not ready to merge yet, because there are serious memory leaks (and some coding guideline issues), I justed wanted to ask you to take a look that the approach is fine, and if you have a suggestion to eliminate the memory leak, then please share the idea :).