我需要第一个 flexigrid 进行 ajax 调用并加载其数据,完成后,第二个 flexigrid 将在轮到它时进行下一个 ajax 调用。我怎样才能做到这一点?
//FILL THE OFFERS GRID
jQuery("#OFFERS").flexigrid({
url: 'index.php?option=com_virtuemart&view=offers&task=getOffers&page=1&format=raw',
dataType: 'json',
singleSelect:true,
colModel : [
{display: 'id', name : 'id', width : 100, sortable : true, align: 'center'},
{display: 'startdate', name : 'startdate', width : 180, sortable : true, align: 'center'},
{display: 'enddate', name : 'enddate', width : 180, sortable : true, align: 'left'},
{display: 'product_name', name : 'product_name', width : 120, sortable : true, align: 'left'},
{display: 'discount_amount €', name : 'discount_amount', width : 100, sortable : true, align: 'left'},
{display: 'discount_percent %', name : 'discount_percent', width : 120, sortable : true, align: 'right'}
],
searchitems : [
{display: 'startdate', name : 'startdate', isdefault: true},
{display: 'enddate', name : 'enddate'},
{display: 'product_name', name : 'product_name'},
{display: 'discount_amount', name : 'discount_amount'},
{display: 'discount_percent', name : 'discount_percent'}
],
sortname: "id",
sortorder: "asc",
usepager: true,
title: 'Offer',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 900,
onSubmit: addFormData,
height: 200,
buttons: [
{name: 'Test', onpress: test}
]
});
//FILL THE PRODUCTS GRID
jQuery("#pnlProducts").flexigrid({
url: 'index.php?option=com_virtuemart&view=offers&task=getProducts&page=1&format=raw',
dataType: 'json',
singleSelect:true,
colModel : [
{display: 'id', name : 'id', width : 100, sortable : true, align: 'center'},
{display: 'name', name : 'name', width : 180, sortable : true, align: 'center'},
{display: 'price', name : 'price', width : 180, sortable : true, align: 'left'}
],
searchitems : [
{display: 'id', name : 'id', isdefault: true},
{display: 'name', name : 'name'},
{display: 'price', name : 'price'}
],
sortname: "id",
sortorder: "asc",
usepager: true,
title: 'Products',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 900,
onSubmit: addFormData,
height: 200,
buttons: [{name: 'Test2', onpress: test}]
});