Hi All,
I have a variable in my javascript - "parent_row_id" that i want to make
its value as the last argument of the url. Then my controller can take
this, and return a bunch of data for the subgrid of this jqgrid.
I found that the below turn my variable to simply a string using the
variable name..... then i got a ticket as there is no definition of
"parent_row_id" there in the controller.
url:'{{=URL(r=request,f='call',args=['json','get_one_purchase_order_item',
parent_row_id])}}'
==>
http://127.0.0.1:8000/purchase/default/call/json/get_one_purchase_order_item/parent_row_id?
I have been trying to get it to work like this... if parent_row_id = 1
http://127.0.0.1:8000/purchase/default/call/json/get_one_purchase_order_item/1?
I have not been successful, and would hope to seek your advices to tackle
it.... Hope you can shed some light...
This is part of my view.
var row_data = $("#list").jqGrid('getRowData', row_id);
console.log(row_id);
console.log(row_data.id);
var parent_row_id = row_data.id;
jQuery("#"+subgrid_table_id).jqGrid({
url:'{{=URL(r=request,f='call',args=['json','get_one_purchase_order_item',
parent_row_id])}}',
data: "{}",
datatype: 'json',
mtype: 'GET',
contentType: "application/json; charset=utf-8",
complete: function(jsondata, stat) {
if (stat == "success") {
var thegrid2 = jQuery("#"+subgrid_table_id)[0];
thegrid2.addJSONData(JSON.parse(jsondata.responseText).d);
}
},
This is part of my controller.
@service.json
def get_one_purchase_order_item():
# db.order_item.category.represent = lambda v: v.name
item_id = request.args[-1]
for r in db(db.order_item.purchase_id ==
item_id).select(limitby=limitby,orderby=orderby):
--
---
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/groups/opt_out.