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

HTTP error 417 / Search not working #184

Closed Rollpan89 closed 3 years ago

Rollpan89 commented 3 years ago

Hey guys!

I've been having trouble with the searchbar with my UIOMaticFields. I keep getting no results no matter what I search for. The filters work as intended, but the searchbar is important.

So i dug around and found that the getPaged() function returns this URL: /umbraco/backoffice/UIOMatic/Object/GetPaged?typeAlias=people&itemsPerPage=40&pageNumber=1&sortColumn=&sortOrder=asc&filters=&searchTerm= which in turn returns HTTP error 417. Not sure if it's correlated or not.

My code looks something like this

[UIOMatic("people", "People", "Members", FolderIcon = "icon-users", ItemIcon = "icon-user", ShowOnSummaryDashboard = true, RenderType = UIOMaticRenderType.List)]
        [TableName("Members")]
        [PrimaryKey("Id", AutoIncrement = true)]
        public class MembersSchema
        {
            [PrimaryKeyColumn(AutoIncrement = true, IdentitySeed = 1)]
            [Column("Id")]
            public int Id { get; set; }

            [UIOMaticListViewField(Name = "E-mail")]
            [UIOMaticField(Name = "Email")]
            [Column("Email")]
            public string Email { get; set; }
    }
Rollpan89 commented 3 years ago

An update: the filter no longer works as well. The list updates when selecting a filter, but no changes in the list is seen. Seems to be the same issue as described above.

TimGeyssens commented 3 years ago

Hey @Rollpan89 which version are you using? mind updating to the latest?

Rollpan89 commented 3 years ago

Hey @TimGeyssens I've updated to version 3.1.14 and I'm still having trouble with the search function.

The error with the filters seems to have moved to my "readable" fields (key value pair) where it doesn't recognize my ignored field.

E.g for the filter issue:

System.Data.SqlClient.SqlException: Invalid column name 'SchoolReadable'.

---

[UIOMaticListViewField(Name = "Skola")]
[UIOMaticField(Name = "Skola")]
[Column("SchoolType")]
[NullSetting(NullSetting = NullSettings.Null)]
public string School { get; set; }

[Ignore]
[UIOMaticListViewFilter(Name = "Skola")]
public string SchoolReadable => MemberEducationCategories.GetAllSchools(School).ToString(); // <- GetAllSchools() =  Dictionary<string, string>

The issue with the search function seems to be the same though.

TimGeyssens commented 3 years ago

yeah you can't use UIOMaticListViewFilter on a non db field... since it will build a db query... and it isn't a column...

Rollpan89 commented 3 years ago

Alright! That makes sense!

However, the main issue still persists with the search function I'm afraid.

TimGeyssens commented 3 years ago

odd, in all browers?

Rollpan89 commented 3 years ago

Yeah. I've tried all browsers. The values I'm searching for is all in the db

Rollpan89 commented 3 years ago

An update: since the project is near its deadline we decided to override all the filtering and search functionality with our own logic, so the issue is no longer critical. I guess the issue was local for our environment so no further action needed for our part in this ticket.