ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: ridwanhabbal on July 24, 2015, 06:06:38 pm
-
Hi,
I have created the following sample based on the downloaded package from the sight. it's all fine but rightclick event is not getting fired
Please check line: $("#grid_table").on( "pqgridrowrightclick", function( event, ui ) {alert();} );
$("#grid_table").pqGrid({
rowRightClick: function( event, ui ) {
//alert(ui.rowIndx);
//alert(ui.rowIndxPage);
var data = ui.dataModel.data[ui.rowIndx];
alert("Rank is: "+data[0]);
}
});
function changeToGrid(that) {
var tbl = $("table.fortune500");
var obj = $.paramquery.tableToArray(tbl);
var newObj = { width: 700, height: 400, numberCell: false, title: "Grid From Table", resizable: false, editable:false };
newObj.dataModel = { data: obj.data, rPP: 20, paging: "local" };
newObj.colModel = obj.colModel;
var columns = [
{ title: "Rank", width: 100, dataIndx: "0", hidden: true },
{ title: "Company", width: 130, dataIndx: "1" },
{ title: "Revenues ($ millions)", width: 190, dataIndx: "2" },
{ title: "Profits ($ millions)", width: 100, dataIndx: "3", align: "right" },
{ title: "Links", width: 100, dataIndx: "4", align: "right" },
];
newObj.colModel = columns;
newObj.dataModel = { data: obj.data, rPP: 20, paging: "local"};
$("#grid_table").pqGrid(newObj);
$("#grid_table").pqGrid({
rowClick: function( event, ui ) {
//alert(ui.rowIndx);
//alert(ui.rowIndxPage);
var data = ui.dataModel.data[ui.rowIndx];
alert("Rank is: "+data[0]);
}
});
$("#grid_table").on( "pqgridrowrightclick", function( event, ui ) {alert();} );
$(that).val("Change Grid back to Table");
tbl.css("display", "none");
}
Thanks and Regards,
Ridwan
-
Hi everybody
Any suggestion? please assist?
Thanks
Ridwan
-
rowrightclick is not in the API of basic version.
http://paramquery.com/api
you could use this:
$(".pq-grid").on("contextmenu", ".pq-grid-row", function(evt){
alert("right click");
});
http://jsfiddle.net/7jnf6s3t/103/
-
Really thanks....
But how can I access the row data. I've been doing something like
//alert(ui.rowIndx);
//alert(ui.rowIndxPage);
var data = ui.dataModel.data[ui.rowIndx];
alert("Rank is: "+data[0]);
for rowCLick
Could you please help?
Thanks
-
Could some one assist me plz
-
$(".pq-grid").on("contextmenu", ".pq-grid-row", function(evt){
//alert("right click");
var rowIndx = $(this).attr("pq-row-indx");
alert(data[rowIndx][0]);
return false;
});
http://jsfiddle.net/7jnf6s3t/104/