ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: forwheeler on December 17, 2013, 09:21:27 pm
-
While looking at the Add, Edit, Delete demo I see that in the addRow function we build a row and use data.push to add to the row collection. After doing this I don't see the new row. I commented out the refreshDataAndView but there is no difference. I assume after the push is where I need to send the new row to the server to add it to my database.
UPDATE
I now add my new row to the database after the push and then call the refreshDataAndView and the grid does not update. If I refresh the page then it updates. I can see in the json returned that the new row is there but the grid ignores it.
var row = [];
row[0] = $frm.find("input[name=test1]").val();
row[1] = $frm.find("input[name=test2]").val();
row[2] = $frm.find("input[name=test3]").val();
data.push(row);
jsonstring = {"Test1": row[0], "Test2": row[1], "Test3": row[2] };
Add(JSON.stringify(jsonstring));//call add method
//$grid.pqGrid("refreshDataAndView");
$grid.pqGrid("refresh");
-
The refreshDataAndView works in firefox but not IE10 or chrome.
-
Are you using location : "local"
If you want that refreshDataAndView should fetch updated remote data, then location should be "remote" and refreshDataAndView should be called after Add(JSON.stringify(jsonstring)); returns.
-
I am using location: remote in datamodel. I moved the $grid.pqGrid("refreshDataAndView") to the success of the ajax in the add function and it still won't refresh the data. I need to refresh the page. It works in the FF browser.
This is my datamodel
var dataModel = {//define datamodel and get data from server
cache: true,
location: "remote",
paging: "remote",
sorting: "local",
sortDir: "down",
//rPP: 20,
//rPPOptions: [10, 20, 40],
dataType: "JSON",
getUrl: function () {
return { url: "/PCA/PCAData/" };
},
getData: function (dataJSON, textStatus, jqXHR ){
return { data: dataJSON };
}
};
-
try cache: false
-
Yes that worked. The browsers must treat that setting differently. Thanks!