Kusumoto / PrimeNG.TableFilter

Helper for use the PrimeNG table load lazy filter in backend use LINQ to Entity
MIT License
18 stars 9 forks source link

Enums filtering support #34

Open duhapunk opened 1 year ago

duhapunk commented 1 year ago

Hello again! I noticed that your lib doesn't support enums. I fixed it like this:

n2pro-wa commented 1 year ago

Works for me, @Kusumoto Could you release the fix?

Kusumoto commented 1 year ago

Works for me, @Kusumoto Could you release the fix?

I already try, it work but TryParse method just work for .NET Standard 2.0 only.

This is the major change because after support this I'll obsolete .NET Framework support.

duhapunk commented 1 year ago

Did you try "manual" TryParse ? Something like this

try
{
   var val = Enum.Parse(property.PropertyType, value.ToString(), true);
   var result = Convert.ChangeType(val, property.PropertyType);
   // additional checks required
   return result;
}
catch (Exception ex)
{
   // do some stuff
   return null;
}
garry-mitchell-coats-com commented 7 months ago

Enum filtering would be great, if this could be incorporated :)