TimGeyssens / UIOMatic

Auto generate an integrated crud UI in Umbraco for a db table based on a petapoco poco (and more)
https://timgeyssens.gitbook.io/ui-o-matic/
Other
67 stars 54 forks source link

Nibble.Umbraco.UIOMatic v5.1.0 Filter and Search not working #211

Closed kudecha closed 1 year ago

kudecha commented 2 years ago

Hi there,

I am using Nibble.Umbraco.UIOMatic v5.1.0 on Umbraco v10.3.1.

The utility works as expected while creating data in Umbraco 'UI-O-Matic' section. The list shows 10 items per page and retrieves correct data and no of items counter on changing the selected page.

However, applying filter on any integer column or applying search terms always returns with no result. If I try to apply filter on string column type, it returns with SQL error with message 'This SqlTransaction has completed; it is no longer usable.'. I have applied 'UIOMaticListViewFilter' attribute with no values to any of its properties.

It would be great if you would look into this and confirm if you see the same behaviour.

I have tried to dig into this issue and it seems that the DefaultUIOMaticRepository.cs GetPaged function might need to be changed a bit.

On https://github.com/TimGeyssens/UIOMatic/blob/055e54fc44bc5823135f9b14f2de293aae6ec925/src/UIOMatic.Core/Data/DefaultUIOMaticRepository.cs Line 218 var p = scope.Database.Page<object>(pageNumber, itemsPerPage, query.SQL); may require you to pass parameters list again which has been previously passed in creating SQL.

Without it, the sql generated is translated as exec sp_executesql N'SELECT * FROM MyCustomTable WHERE IsDeleted = 0 AND (1=0 OR Name like @0 OR Email like @1 ) ORDER BY Id asc OFFSET @0 ROWS FETCH NEXT @1 ROWS ONLY',N'@0 bigint,@1 bigint',@0=0,@1=10

Would you please look into this and let me know what should be done to solve this issue?

Thanks & Regards, Jay

patrickdemooij9 commented 2 years ago

Hi @kudecha

Thank you for the report. I'll see if I can take a look at this somewhere this week. It seems like you have already done some research, so that is already great. Thank you!

Kind regards, Patrick

TimGeyssens commented 1 year ago

fixed in 5.1.2, thanks for the detailed bug report