ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: STEVE on September 21, 2022, 08:43:27 pm
-
Hello paramvir?
I want to know how to go to the target URL when the cell were double clicked.
I guess below code will be answered to my question.
But, I don't understand it at all. I need good examples.
Would you help me to get the good sample codes?
cellDblClick( event, ui )Type: pqGrid:cellDblClick
Triggered when a cell is double clicked in pqGrid.
event
Type: Event
ui
Type: Object
rowData
Type: Object
Reference to 1-dimensional array or object representing row data.
rowIndx
Type: Integer
Zero based index of the row.
dataIndx
Type: Integer or String
Zero based index in array or key name in JSON.
colIndx
Type: Integer
Zero based index of the column corresponding to cell.
Code examples:
Initialize the pqGrid with the cellDblClick callback specified:
1
2
3
$( ".selector" ).pqGrid({
cellDblClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellDblClick event:
1
$( ".selector" ).on( "pqGrid:cellDblClick", function( event, ui ) {} );
-
cellDblClick is a simple event which is fired when a cell is double clicked.
Sample code to open a url upon dblclick is given below:
$(function () {
var data = [
{ rank: 1, url: 'http://www.google.com', revenues: 339938.0, profits: 36130.0 },
{ rank: 2, url: 'http://www.apple.com', revenues: 315654.0, profits: 11231.0 }
];
var obj = {
width: "80%",
height: 400,
resizable: true,
title: "Grid From JSON",
showBottom: false,
scrollModel: { autoFit: true },
dataModel: { data: data },
cellDblClick: function(evt, ui){
var url = ui.rowData[ ui.dataIndx ];
var win = window.open(url, '_blank');
win.focus();
}
};
$("#grid_json").pqGrid(obj);
});
-
Thank you for your response.
By the way, I want to know how to fix the column to double-click,
Or when only the PID column was clicked, new windows would pop up.
How to change the below code with two column values?
var url = ui.rowData[ ui.dataIndx ];
{ title: "패키지", width: 200, dataType: "string", dataIndx: "pkg" },
{ title: "프로그램ID", width: 200, dataType: "string", dataIndx: "pid" },
-
column of interest can be checked with if condition.
cellDblClick: function(evt, ui){
if(ui.dataIndx == 'pid'){
var url = ui.rowData[ ui.dataIndx ];
var win = window.open(url, '_blank');
win.focus();
}
}
-
Thank you~
By the way, I need two columns like the below code.
var url = "HTTP://xxx.xxx.xxx.:9090/" + ui.rowData[ ui.dataIndx('pkg') + "/" + ui.dataIndx('pid')] ;
Is it able to use this way?
Or is there any other way?
-
I understand that you have been trying to concatenate strings from 2 columns to create complete url
var url = "HTTP://xxx.xxx.xxx.:9090/" + ui.rowData[ 'pkg' ] + "/" + ui.rowData[ 'pid' ] ;