I believe you are confusing a couple things here.  The code you're using is 
trying to use a server-side data set, but the 

data:{{=results}},

is using the results passed to the view as the data to display, not the 
data you're getting back from the ajax call.

I'll try to make some time later this morning to build up a demo for you.  
I've been working with datatables.net and web2py A LOT in the past few 
weeks and have some good working samples, but will need to tear some of it 
down to the bare essentials to make what I have more understandable.

Gotta run but will get back to this in a few hours.

-Jim


On Thursday, June 13, 2019 at 6:19:18 PM UTC-5, Cristina Sig wrote:
>
> Thank you @John 
> yes, I have been checking DT docs and it seems that I need to add that 
> data, I tried it but the sorting and ordering is not working at all. 
> Do you have any idea or example how to deal with that?
>
> El martes, 11 de junio de 2019, 9:43:14 (UTC-3), John Bannister escribió:
>>
>> @Leonel .. I think this will work well with client side but not 
>> serverside datables but may be wrong.
>>
>> @Cristina:
>>
>> My understanding of serverside processing is that you will need to have a 
>> few more items returned to datatables as outlined in the DT docs for 
>> serverside processing.
>>
>> Your response to the request from DataTables should look something like 
>> this for serverside processing:
>>
>> return dict(draw=sEcho, recordsTotal=iTotalRecords, 
>> recordsFiltered=iTotalRecords, data=aaData)
>>
>> You will also need to move your sorting, filtering and ordering to the 
>> server (which is a bit more complicated) but doable.
>>
>> As said I could be wrong.
>>
>> BR
>> John
>>
>>
>> On Tuesday, 11 June 2019 10:52:42 UTC+2, Leonel Câmara wrote:
>>>
>>> It's because you're not using the generic.json view and you're also not 
>>> setting the response.headers content-type to json. I would simply change 
>>> your function to this which will do everything for you:
>>>
>>> def manageCareer():
>>>     rows = db((db.Career.faculty == db.Faculty.id)&(db.Career.degree == 
>>> db.Degree.id)).select()
>>>     return response.json({'results': rows}) 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/29806e98-d952-4774-b679-4771f848e9fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to