ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: webifi on February 03, 2015, 06:51:25 am
-
I keep getting "Uncaught TypeError: Cannot read property 'pq_detail' of undefined" when trying to use "deleteRow" on a grid that uses detailModel. (The detailModel is yet another grid, but the error happens even if the detail hasn't been expanded.) Seems to be failing in pqGrid's detachInitView method.
Is there something different I must do to delete rows in a grid using detailModel?
-
Update:
Here's a jsfiddle showing the issue:
http://jsfiddle.net/gq47cxev/
And one with the details removed to show that the delete button works:
http://jsfiddle.net/gq47cxev/2/
(Note, the data sources for these jsfiddles use CORS proxy to load data from your server. CORSproxy seems to be running slow today, so it may take a while for the data to load)
Update2:
Here are jsfiddles using yahoo's yql instead of corsproxy (corsproxy seems to be getting DDOS'd):
Showing the non-working deleteRow (has detail):
http://jsfiddle.net/g897xzqx/
And with detail removed (delete button works now):
http://jsfiddle.net/g897xzqx/1/
-
Having just purchased pqGrid (My app has integrated pqGrid far enough to the point where I'm committed to its use.), please consider the above a support request, and move to the appropriate forum -- if needed.
-
I haven't checked it all but I found a problem in your implementation:
$grid.on('pqgridrefresh', function(){
var $mgrid = $(this);
$mgrid.find('.delete_btn').click(function(){
console.log("dele button pressed");
var $tr = $(this).closest('tr'),
rowIndx = $mgrid.pqGrid('getRowIndx',{
$tr:$tr
}).rowIndx;
console.log("Deleteing row:"+rowIndx);
$mgrid.pqGrid('deleteRow',{rowIndx:rowIndx});
});
});
$mgrid.find('.delete_btn') would also found the delete buttons of the detail grid. Correct way is to assign a unique class (e.g., btn_cls) to the buttons column of the outer grid.
selector would be $mgrid.find('.btn_cls .delete_btn');
Please correct it and any other similar problem and let me know your results.
-
See corrected jsfiddle:
http://jsfiddle.net/g897xzqx/2/
Still has the same problem. (My actual code does bind each grid's buttons separately -- This jsfiddle is just a very simplified version of it, with the minimum needed to trigger the issue.)
-
It still has the same implementation problem.
$grid.on('pqgridrefresh', function(){
var $mgrid = $(this);
$mgrid.find('.delete_btn1').click(function(){ //incorrect
console.log("dele button pressed");
var $tr = $(this).closest('tr'),
rowIndx = $mgrid.pqGrid('getRowIndx',{
$tr:$tr
}).rowIndx;
console.log("Deleteing row:"+rowIndx);
$mgrid.pqGrid('deleteRow',{rowIndx:rowIndx});
});
});
-
Where is the problem with that?
It selects ".delete_btn1". class "delete_btn1" only exists in the topmost grid. Others are "delete_btn" (note the missing "1"), so their buttons are never activated. Click a delete on the topmost grid and you'll see the issue.
-
Updated to unbind and re-bind the click event, in case the grid is refreshed:
http://jsfiddle.net/g897xzqx/3/
Still the same issue.
-
Simplified ever further (only one detail deep, no delete button column on detail):
http://jsfiddle.net/g897xzqx/4/
Still the same issue.
-
yes, got it. I'm looking into it.
Thanks
-
Thanks.
Do you think this is a bug in pqGrid, or an issue with my use of it?
-
This is a bug ( or editing not supported/tested fully along with row details as of 2.3.0 ) and would be fixed in the next version.
If I come across any temporary workaround for this version, I would let you know.
-
Kind of a big issue for me. Much of my UI depends on this functionality.
I anxiously await your solution. Thanks.
-
Any ETA for a new version of pqGrid that will fix this issue?
-
ETA for release is this week.
-
Still planning on releasing the fix this week?
-
v2.4.0 has been released.