After attempting to draw from JSON examples with and without using
@service.json:
The following use of JSON does not retrieve data from the JSON callback in
the controller
$(function () { // this function is for SlickGrid
$.getJSON('/appname/controller/jsonfunc.json', function (vals) {
// This part (the success function) is not reached nor the json
function called
// note: I have also tried:
// getJSON("{{=URL('call', args=['json','jsonfunc'])}}")
// gets the data from the success function and process
for (var i = 0; i < vals.length; i++){
var d = (data[i] = {});
d["id"] = vals[i].id;
d["rName"] = vals[i].rName;
d["info"] = vals[i].info;
d["other"] = vals[i].other;
}
*in controller:*
@service.json
def jsonfunc():
query = db(db.data.created_by==usr_id)
# retrieve a list of dicts to dump as json
rowDicts = query.select(db.data.id, db.data.name,
db.data.item1, db.data.data2,
).as_dict()
return json.dumps(rowDicts.values())
// ...sets slick grid here, exits JSON and processes the remaining
wrapping function
Any direction is very much appreciated.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.