ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: przemek on August 06, 2014, 05:15:04 pm
-
I try set dataModel.data option and have I a problem.
This is my code:
$('div#pqgrid').pqGrid("option", "dataModel.data", response.data);
$('div#pqgrid').pqGrid("refreshDataAndView");
console.log(response.data);
console.log($('div#pqgrid').pqGrid("option", "dataModel.data")); //return null
$('div#pqgrid').pqGrid( "filter", {
data: [
{ oper: 'replace', dataIndx: 'ID', condition: 'contain', value: campaignRef }
]
});
My problem is filter below data setter is not working. (exactly show empty results)
Althought I set dataModel.data the console.log return null.
I thought refreshDataAndView working asynchronous but when I comment filter, console.log with dataModel.data return valid results:
$('div#pqgrid').pqGrid("option", "dataModel.data", response.data);
$('div#pqgrid').pqGrid("refreshDataAndView");
console.log(response.data);
console.log($('div#pqgrid').pqGrid("option", "dataModel.data")); //return valid data
//$('div#pqgrid').pqGrid( "filter", {
//data: [
// { oper: 'replace', dataIndx: 'ID', condition: 'contain', value: campaignRef }
//]
//});
filterModel.type and dataModel.location are "local"
I will be very grateful for help.
-
refreshDataAndView refreshes both filter and view.
paramquery.com/pro/tutorial#topic-refreshView
1) So there is no need to call refreshDataAndView in your case since you call filter method just after that.
2) Syntax for filter method is incorrect.
It should be
$('div#pqgrid').pqGrid( "filter", {
oper: 'replace',
data: [
{ dataIndx: 'ID', condition: 'contain', value: campaignRef }
]
});
-
Thanks it works.