Server side SearchBuilderDetails and how to process examples
Server side SearchBuilderDetails and how to process examples
I am pretty new to using Datatables and I love the search builder functionality. I am trying to write it using the server side code but I have found that there is virtually no examples or documentation for doing this. What little documentation on this website doesn't help me much and there are no examples of how to write the code in the controller(.net mvc or core).
In my code I see that in the results view for the Request.Form object, it has all my criteria. Rather than have to build something that parses this and then applies it as logical criteria to my data context, is there some way to use the Datatables library to parse it and make it easier to manage? For example I see there is an object "SearchBuilderDetails". Is there a way to easily put the searchbuilder request details into a List<SearchBuilderDetails> object?
This is what I see in the Request.Form object related to searchBuilder:
Any help would be appreciated.
Answers
The documentation for SearchBuilder's server-side processing, is available here.
The easiest way to use SearchBuilder with server-side processing is to use our Editor .NET libraries. See also this blog.
If you prefer to write your own, the source for our implementation is available under the MIT license.
Allan
Sorry, you also specifically asked about how to parse the HTTP parameters. It frustrates me no end that .NET doesn't have a nice easy way to do that. The closest I've found is to use
ajax.data
to send the data to the server as JSON (last example on that page) and then just parse the JSON at the server-side.Alternatively, our dll as a
DtRequest
object which can be used to parse theForm.Request
into aDtRequest
object. It's still a pig though imho. If you can use our libraries, it would probably save you a whole lot of time.Allan