Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    showPrintPreview for a grid, predict number of rows

    I am implementing the Isc.Canvas.showPrintPreview in my application for ListGrids. Sometimes the data behind the ListGrid will be small and thus .showPrintPreview will display all the records, great.

    Sometimes, however, the dataset is large and is paged in the ListGrid. In this case, I would like to warn the user that Print Preview will not show all the records. To do that, I need to figure out how many total records exist in the database (which I can do) and also how many records will be produced when showPrintPreview is invoked. This is the tricky part. So far I have tried:
    • getTotalRows() - This gets me the total number of rows in the recordset, too many
    • getVisibleRows() - This gets me the number of rows that you can actually see on the screen, not as many that will be produced with .showPrintPreview
    • getDrawnRows() - Similar to getVisibleRows(), number is lower than what will be produced with .showPrintPreview
    Is there a way to predict how many rows will be rendered with .showPrintPreview before it is actually called?

    #2
    When you print a grid, the cached range of rows around the first visible row will be printed. You can find the first visible row by calling ListGrid.getVisibleRows(). We've exposed a new API to let you get the cached range from this, ResultSet.getCachedRange(). (You'll need to use the grid's data property to get the ResultSet.)

    This API is officially documented now for SC 12.1+ and newer releases.

    Comment

    Working...
    X