You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Saúl Ortega 70cce2b4c7
6 years ago
.gitignore Initial commit 6 years ago
LICENSE Initial commit 6 years ago Update 6 years ago
filter.go Update and rename datatables.go to filter.go 6 years ago
generic.go Create generic.go 6 years ago
response.go Create response.go 6 years ago


Simple parser for DataTables server-side processing.


go get -u


import ""

//Parse receive *http.Request and returns a Filter struct
filter, err = datatables.Parse(r)
if err != nil {
	//Handle error

//Get data from DB

response := filter.PrepareResponse()
response.RecordsTotal = 629635
response.RecordsFiltered = 50
response.Data = rows

//WriteResponse receive http.ResponseWriter. It send the response even if there are any error.
//Use WriteResponseOnSuccess(w) if you do not want to send the response when there is an error.
err := response.WriteResponse(w)
if err != nil {
	//Handle error


type Filter struct {
	Draw        int
	Start       int
	Length      int
	Order       []Order
	Columns     []Column
	SearchValue string
	SearchRegex bool

type Column struct {
	Data        string
	Name        string
	Index       int
	Orderable   bool
	Searchable  bool
	SearchValue string
	SearchRegex bool

type Order struct {
	Column Column
	Dir    string