ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: marruendarol on July 23, 2014, 10:31:30 am
-
Hi, i am trying to form my own data to send to the server by using getURL but i need to check permissions in others tables to establish the final data to send to the Grid , the problem is that getURL is not async and it always return url & data before my querys are finish , is there a way to override this function or modify to make getURL wait for my database response?
Or as alternative solution ... any ideas how i can perform some database calls before appending data to getURL?
Example :
getUrl: function (ui) {
var queryObj = {}
queryObj.pageNumber = ui.pageModel.curPage;
queryObj.nPerPage = ui.pageModel.rPP ;
queryObj.sortDir = ui.dataModel.sortDir;
queryObj.sortIndx = ui.dataModel.sortIndx;
var data = processPolicies(queryObj,function(data){
return { url: apiURL + "readCollection", data: data};
})
},
function processPolicies(queryObj,callback){
$.ajax(.......
success: callback(response);
}
Ty in Advance.
-
getUrl is a sync callback function like any other js function.
you could do either of these:
1) make your ajax call a sync call in processPolicies.
or
2) use dataModel.location = 'local' and use $.ajax to load data in the grid.
-
but if i do local , i will lose remote paging and remote sorting functionallity? or there is a way to combine it with grid listeners?