Kusumoto / PrimeNG.TableFilter

Helper for use the PrimeNG table load lazy filter in backend use LINQ to Entity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filtering with nullable properties

crega opened this issue · comments

commented

Hello we have an issue (exception) while filtering dataset.
We have an IQueryable which some properties from database , and some of them are typeint? (nullable integer)

Those propeties are part of filterable columns in prime ng table.
When we send TableFilterModel object to our backend containing filter value 1 (integer) matchMode equals

for example { filters: { num1Nullable: { value: 1, matchMode: \"equals\" } } , first: 0, globalFilter: null, multiSortMeta: undefined, rows: 10, sortField: \"Num1\",sortOrder: -1 } where num1Nullable is of type int?
we get an exception thrown

Expression.Constant(Object value, Type type)
LinqOperator1.AddFilterProperty(String propertyName, Object propertyValue, String extensionMethod, OperatorEnumeration operatorAction, Boolean isNegation) line 57 TableFilterManager1.BaseFilterDataSet(String key, TableFilterContext value, OperatorEnumeration operatorAction) line 104
TableFilterManager1.FilterDataSet(String key, TableFilterContext value) line 70 PrimeNGTableFilterExtension.PrimengTableFilter[T](IQueryable1 dataSet, TableFilterModel tableFilterPayload, Int32& totalRecord) line 43

Indicating that var propertyConstant = Expression.Constant(castValue, propertyType); threw argument excpetion.

Can you help us ?

Hi, thank you for report the issue

I will release bug fix in next version.

commented

Hi. I have already fixed it for our team, using same pattern as for DateTime? You have provided. Also I have written many tests, will post it on Monday or Tuesday.