Announcement

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

    Print Preview for ListGrid - Can't Print All Records?

    Hello:

    I'm just starting to take a look at the Print Preview functionality in SmartGWT and I must say that its quite good except for one thing: If I have a listgrid with say 1000 items in it when I print it only prints what actually VISIBLE on the screen.

    So my question is this: Is there any way to configure the print preview/printing functionality so that it prints ALL of the records in a ListGrid even if they're not visible at the time?

    Thanks.
    ---
    Chris

    #2
    Wow no-one has run into this problem before? Guess its just me.

    Comment


      #3
      simil problem

      hey hello guys. I'm having similar problem when attemping to print some component cell ListGrid based on others ListGrid. When setCanExpandRecords() is true listGrid is expecting user to click a field so it can be expanded.
      So I expand some field and I get other listGrid with it's own records. When I call Canvas.showPrintPrewiew... the main grid is drawn to be printed .. with expanded record but nothing inside of it (despite it has records of the other listGrid)

      Hope to be clear, of not let me know please.
      Thanks you so much!

      Comment


        #4
        This has been hashed a lot, it is browser dependent. Different browsers handle it differently so there is no bulletproof printing mechanism. I have grids with hundreds of rows that print fine in Chrome, Safari but not in Mozilla and IE. An export is usually a better alternative or providing a static html output by traversing your grid.

        Comment


          #5
          luck of luck

          I was happy to know that this listgrid printpriview problem has to do with browser rather than smartgwt, but when I test my app on chrome got surprise.
          this it's a chrome pic where it shows print proview of listgrid with component cell (listgrid inside cells). the expanded cells has data on it but it's invisible on printpreview.

          I have it like this

          Window-->(child)Canvas--->(child)VLayout--->(member)ListGrid

          thanks for your help!
          Attached Files

          Comment


            #6
            SmartGWT 2.2
            Firefox 3.6.11
            I have a similar problem with printing all rows in Print Preview. I have grid with maybe 50 - 100 rows, but it only prints the first page.
            After reading post from svjard, where he is saying "I have grids with hundreds of rows that print fine in Chrome", I just install Chrome (standalone install) to test this, and it prints even worse then Firefox.

            I also added code grid.setPrintMaxRows(1000), since the default is 100, but nothing helps. Am I missing some additional code or settings to print all rows ?

            Thanks.

            Comment


              #7
              Only what's loaded will be printed. If it's safe to do so in terms of data volume, you can set dataFetchMode:"basic" to load all rows (for both normal interaction and printing).

              Otherwise, consider what's a reasonable maximum number of records to print, and trigger a fetch up to that maximum by calling grid.data.getRange() and waiting for dataArrived before printing if this causes a fetch.

              As someone mentioned, to really dump the entire dataset no matter how large, consider server-based export instead. The Pro product has built-in export to CSV, XLS, OOXML and other formats.

              Comment


                #8
                The data is definitely loaded when I am trying to open Print Preview. I even scroll up/down to make sure all rows are available in preview.
                I just tested with grid.setDataFetchMode(FetchMode.LOCAL) and (FetchMode.BASIC), but no difference. I only have 50 - 60 rows to print, but it always just prints 1 page. So I am not sure if there are a setting to print all pages ( I checked that my printer options is set to print all).

                I am already doing export to XLS, it just Print is one of the options which should be available to users.

                Comment


                  #9
                  Printing functionality should certainly be working fine for a grid showing only 50-60 rows.

                  Here's some sample code demonstrating this against the shipped 'built-in-ds' example.
                  This example shows a listGrid fetching just over 100 rows from the supplyItem dataSource, and print preview / print functionality works as expected.

                  Code:
                  	public void onModuleLoad() {
                  
                  		final ListGrid supplyGrid = new ListGrid();
                  		supplyGrid.setDataSource(DataSource.get("supplyItem"));
                  		supplyGrid.setInitialCriteria(new Criteria("SKU", "12"));
                  		supplyGrid.setAutoFetchData(true);
                  		supplyGrid.setDataFetchMode(FetchMode.BASIC);
                  		supplyGrid.setWidth(600);
                  		supplyGrid.setHeight(300);
                  		
                  		supplyGrid.draw();
                  		
                  		Button printButton = new Button();
                  		printButton.setTitle("Print!");
                  		
                  		printButton.addClickHandler(new ClickHandler() {
                  			
                  			@Override
                  			public void onClick(ClickEvent event) {
                  				Object[] printArr = new Object[] {
                  						"Total rows in this grid:" + supplyGrid.getTotalRows(),
                  						supplyGrid
                  				};
                  				Canvas.showPrintPreview(printArr);
                  				
                  				
                  			}
                  		});
                  		printButton.setTop(400);
                  		printButton.draw();
                  		
                  	}
                  Clearly something else must be happening in your case - can you post sample code demonstrating where printing is failing for you with a smallish number of rows (less than 200, say)?

                  Comment


                    #10
                    on smartgwt 2.2.using IE8.

                    My listgrid has a nestedgrid being populated on click or row header liek showed in showcase.

                    The print preview is not showing the nested grid expanded data in it.

                    I saw that the Print button on showcase also is doing the same and not able to show teh nested grid populated data in print preview.

                    Please let me know if there is solution.

                    Comment


                      #11
                      The nested grid not printing issue would seem to be a separate issue and a duplicate of this thread: http://forums.smartclient.com/showthread.php?t=13996 - we'll discuss that in that other thread.

                      Comment

                      Working...
                      X