Individual column searching with MJoins
Individual column searching with MJoins
Hi,
I have correctly implemented the individual column searching in the editor, but I have a problem when dealing with multiple joins.
If I individually search a column which is "linked" to the main table with a multiple join, I get the following error:
DataTables warning: table id=editorTable - Unknown field: Operators (index 13)
I created my editor in C#:
var editor = new Editor(db, "Main", "Main.Id").Model<MainDTO>("Main")
.Field(new Field("Id").Set(false))
// other fields
.MJoin(new MJoin("Operators")
.Link("Main.Id", "MainOperators.Main_Id")
.Link("Operators.Id", "MainOperators.Operator_Id")
.Model<MainOperatorDto>()
The problem arises when searching (in the browser) in the Operator column, as the request sent to the server contains "Operators" as field name:
request.Params["columns[13][data]"] --> Operators
But the field "Operators" is not defined in my editor model.
How can I tell the editor, server side, that he must search in the joined table?
If I correctly understand, I can't just define a new field, as the would be parte of the "main" table...
Thanks!
This question has an accepted answers - jump to answer
Answers
The .NET libraries don't support search on Mjoin columns with operating with server-side processing I'm sorry to say.
How many records do you have in your table? Do you need server-side processing)?
Allan
Yes, for me server-side processing is absolute a need.
Any idea how can I work around this limitation?
The only option is to create a VIEW which will do the Mjoin for you, and then perform the search on VIEW. Exactly how you do the Mjoin will depend upon the database you are using (which is why it isn't in Editor).
I've been working on exactly that for server-side processing with Postgres and NodeJS recently, for our CloudTables software. Since you can have multiple levels of joins, I ended up using a recursive CTE. It is not trivial I'm afraid.
Regards,
Allan
Thanks!