Revive pretty old thread!!!

Hello Vineet,

I fall on this thread today as I was trying to put serverside to work with
datatables...

I also read this threa on stackoverflow :
http://stackoverflow.com/questions/6476133/json-data-for-jquery-datatable-in-web2py

Until now here what I come with :

def show_data():
    return dict()

def get_data():
    query='SELECT * FROM v_result_all;' #"(db['v_result_all'].id > 0)"
    iTotalRecords='SELECT COUNT(*) FROM v_result_all;'
    iTotalDisplayRecords = iTotalRecords
    custdata = {}
    custdata['aaData'] = db.executesql(query)
    custdata['iTotalRecords']=db.executesql(iTotalRecords)[0][0]

custdata['iTotalDisplayRecords']=db.executesql(iTotalDisplayRecords)[0][0]
    custdata['sEcho']=1
    return response.json(custdata)

But when calling show_data view datatables complains about not able to
parse the json response...

I am not sure if it because of utf-8 since web2py return special character
in unicode (ex.: "\u00b5") or may be because of miss match in the number of
column...

Thanks for any help!

Richard

On Sun, Sep 4, 2011 at 10:22 AM, Vineet <vineet.deod...@gmail.com> wrote:

> @Richard & any other web2py soul interested in dataTables with
> serverside json,
>
> This refers to the post by Richard Vézina --
>
>
> https://groups.google.com/group/web2py/browse_thread/thread/f8e6bedbfd457160/00b3b1fbf91b1319?hl=en&lnk=gst&q=weekend+vineet#00b3b1fbf91b1319
>
> At last, I got time to tinker with datatables & json.
> I can now successfully request server side script to return json
> output.
>
> If you are still looking for a solution with your code, maybe I can be
> useful to share my findings.
>
> :-)
> Vineet

Reply via email to