jquery - Using Datatable's server side processing with Django Templates -


i have been using datatables on django implementation. tables displayed on web pages have gotten big enough need enable server side processing take load off client side. unable datatables work server side processing.

urls.py:

urlpatterns = patterns('',     url(r'^get_customers$', views.get_customers, name = "get_customers"), ) 

views:py

def get_customers(request):     json_test = json.dumps({                            "draw": 1,         "recordstotal": 1,         "recordsfiltered": 1,         "data": [                          "test",                 "test",                                    "test",                                      "test"                                ]})     return httpresponse(                     json_test,                     content_type="application/json"     ) 

template:

        <table id="table_id" class="table table-striped"             data-url="{% url 'dashboard:get_customers' %}">           <thead>             <tr>                 {% block table_head %}                 <th>customer</th>                 <th>devices</th>                 <th>score (%)</th>                 <th>status</th>                 {% endblock table_head %}             </tr>           </thead>           <tbody>           </tbody>       </table> 

jquery.data-table-init.js:

$(document).ready( function () {     $('#table_id').datatable({                           "processing": true,                           "serverside": true,                           "ajax": $(this).attr('data-url'),      }); }); 

i getting output manage.py:

[04/jun/2015 14:07:20] "get /dashboard/ http/1.1" 200 9328 [04/jun/2015 14:07:20] "get /static/dashboard/css/base.css http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/bootstrap-3.3.4-dist/css  /bootstrap.min.css http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/js/jquery-1.11.3.min.js http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/bootstrap-3.3.4-dist/js/bootstrap.min.js http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/datatables-1.10.2/media/js/jquery.datatables.min.js http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/js/jquery.data-table-init.js http/1.1" 304 0 [04/jun/2015 14:07:20] "get /static/dashboard/js/jquery.csv-export.js http/1.1" 304 0 [04/jun/2015 14:07:20] "get /dashboard/?draw=1&columns%5b0%5d%5bdata%5d=0&columns%5b0%5d%5bname%5d=&columns%5b0%5d%5bsearchable%5d=true&columns%5b0%5d%5borderable%5d=true&columns%5b0%5d%5bsearch%5d%5bvalue%5d=&columns%5b0%5d%5bsearch%5d%5bregex%5d=false&columns%5b1%5d%5bdata%5d=1&columns%5b1%5d%5bname%5d=&columns%5b1%5d%5bsearchable%5d=true&columns%5b1%5d%5borderable%5d=true&columns%5b1%5d%5bsearch%5d%5bvalue%5d=&columns%5b1%5d%5bsearch%5d%5bregex%5d=false&columns%5b2%5d%5bdata%5d=2&columns%5b2%5d%5bname%5d=&columns%5b2%5d%5bsearchable%5d=true&columns%5b2%5d%5borderable%5d=true&columns%5b2%5d%5bsearch%5d%5bvalue%5d=&columns%5b2%5d%5bsearch%5d%5bregex%5d=false&columns%5b3%5d%5bdata%5d=3&columns%5b3%5d%5bname%5d=&columns%5b3%5d%5bsearchable%5d=true&columns%5b3%5d%5borderable%5d=true&columns%5b3%5d%5bsearch%5d%5bvalue%5d=&columns%5b3%5d%5bsearch%5d%5bregex%5d=false&order%5b0%5d%5bcolumn%5d=0&order%5b0%5d%5bdir%5d=asc&start=0&length=10&search%5bvalue%5d=&search%5bregex%5d=false&_=1433437640548 http/1.1" 200 9328 

in addition output. mozilla firefox's webconsole telling me there typeerror: g null , data tables giving following output: datatables warning: table id=table_id - invalid json response. more information error, please see http://datatables.net/tn/

i feel missing step, between datatables documentation, tutorials , other similar stack overflow questions can't seem figure out be.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -