1

I am trying to achieve server side pagination with HTSQL and jQuery Datatables with server side being Django. The datatable initially requires total number of records so that it could manage the pagination. So if I have a simple HTSQL query like:

/program

(click the link below for preview)

/program

I would simply do:

/count(program)

/count(program)

and I would get the total number of records which my simple query is going to return. But for instance, if I have a HTSQL query like:

/program.filter(school_code=$code){school_code, code, title}:where($code:='eng')

/program.filter(school_code=$code){school_code, code, title}:where($code:='eng')

(my Queries are much more complex than that but this would do for an example. Like I have distinct '^' as well as nested queries)

and now I want to get a count of number of records I would get if I run this query so that I could further use it to initialize any table for server side pagination. I tried:

/count(program.filter(school_code=$code){school_code, code, title}:where($code:='eng'))

/count(program.filter(school_code=$code){school_code, code, title}:where($code:='eng'))

but got error "Function 'count' expects 1 argument; got 3".

Any clue how could I get the count/number of records which my query is going to return?

4

1 回答 1

2

从中删除选择器 {},count()记录计数将更正。

/count(program.filter(school_code=$code):where($code:='eng'))
于 2013-12-23T18:04:41.100 回答