ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: ckrosnowski on September 25, 2014, 11:31:33 pm
-
hello,
when the grid gets re-sorted, how can I get a listing of the rows within that current state?
let me explain my problem.
I have an external function that links map markers to rows on the grid.
when the map marker is clicked, I call this:
$("#gridContainer").pqGrid("setSelection", { rowIndx: this.DisplayNumber, focus: false });
// set the row where rowIndx = this.DisplayNumber
it works great, until the user sorts the grid in any way - then the MapMarkers vs rowIndx becomes out of sync.
basically what I need to do is to be able to set the row selection based on the value of a cell within the desired row, so something like this maybe?
$("#gridContainer").pqGrid("setSelection", { MapMarker: this.DisplayNumber, focus: false });
// set the row where the row's cell 'MapMarker' = this.DisplayNumber
thanks!!!
-
does this make sense? I thought I had I solved but I was wrong....
-
when the grid gets re-sorted, how can I get a listing of the rows within that current state?
$grid.pqGrid( "selection",
{ type:'row', method:'getSelection' }
);
I need to do is to be able to set the row selection based on the value of a cell within the desired row
To set selection based upon a cell value, it could be something like this.
var $grid = $("#gridContainer"),
data = $grid.pqGrid( 'option', 'dataModel').data;
for(var i=0; i< data.length; i++){
var rowData = data[i];
if ( rowData['MapMarker'] == this.DisplayNumber ){
$grid.pqGrid("setSelection", { rowIndx: i, focus: false });
break;
}
}
-
I was thinking of this exact logic, just wasn't sure how to get the data from the grid (outside of the grid).
This works exactly how I need it to.
Thanks for the top-notch product / support!