ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: pranit@srcomsec on November 18, 2022, 12:19:06 pm
-
Please advise how to get a list of rows visible on the grid.
For example, the data model with gird is 2000 rows, the grid height can be changed anytime.
If the grid shows 20 rows after adjusting the height then it returns 20 rows only, If the grid shows 30 rows after adjusting height then returns 30 rows.
-
Visible row indices can be obtained by getViewPortIndx method.
https://paramquery.com/pro/api#method-getViewPortIndx
-
Thank you for this, with this method we are getting an index of the start and end rows. If we need to get data for the start & end row index then we need to loop and get all details.
I am using the method below to get these rows. Please advise if you see this is not correct.
var loGridSymbols = $("#gridfilter1").pqGrid("getData", { dataIndx: ['stExchange', 'stSymbol', 'pq_empty'] });
var loActiveRows = loGridSymbols.filter((x) => { return x.pq_empty == false; });
-
That's incorrect.
Row data can be obtained from rowIndx by pageData[ rowIndx ]. So first and last visible row in the viewport can be obtained as:
var pageData = grid.pageData();
var firstRow = pageData[ obj.initV ];
var lastRow = pageData[ obj.finalV ];
where obj is returned by getViewPortIndx method.
-
Thank you for your quick response.
As per your suggestion, we can get 1st and last row's details. We need all rows data between the start (obj.initV) and end row (obj.finalV) index.
Let me know if you have any suggestions.
-
you can get all rendered rows as an array with slice method.
var renderedRows = pageData.slice( initV, finalV+1);
-
That is perfect!
Thank you very much.