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

  • Issues with listgrid print preview.

    I have a listgrid with a couple of columns, where one is "note" and can be very large. When there is a lot of text, the columns becomes so big so that the other columns are squeezed together. In the grid itself this is not an issue, since i call setWidth on the other columns, and that is respected.

    However, in the print preview this is not the case, and the other columns are shrinked so that there's for example wordwrap on datetimes.

    I have tried setting wrap to false, tried setting minwidth on all other columns, but nothing works. If i do setWidth in CSS manually using firebug it works.

    So, this is my question: Is there any way for me to specify that a specific listgrid column should have a minwidth attribute that makes it into the print preview?

    As an aside, i noticed that the print preview is not resized when the window is resized. Is this by design? It looks kind of strange.

  • #2
    We don't try to control the widths of columns in the print preview and just let browser heuristics kick in, because we don't really know the target overall width for what's being printed, so we don't know how to allocate sizes to columns. You didn't mention which browser - which is it?

    When you refer to these settings you've tried, are you referring to grid settings or manipulating the HTML after the grid has generated it? The former would not be expected to work, since the printed HTML doesn't use those settings. But the latter approach should work if you want to try to inject additional settings to influence printing. You could also have a CellFormatter that detects that printed output is being asked for, and adds a containing <span> or <div> to the cell contents to influence the wrapping width or turn off wrapping for other columns.


    • #3
      Thanks for quick response!

      When i mention i tried minwidth, wrap to false etc, that is the grid properties, via java code. This does not seem to work.

      However, if i use FireBug in Firefox on the print preview, and manually add a CSS "minWidth" property on the column, it works, so technically it seems to me that it should be possible for it to work.

      So youi mean that i could manually add the minwidth property in the java code? Not sure how i would do that.


      • #4
        Right, both of our suggestions above would be modifying the HTML - one after calling getPrintHTML() (e.g.: search and replace) and the other via a CellFormatter that behaves differently when printed HTML is being generated.


        • #5
          Ok, how does a cellformatter know that it is printed html that is being generated?


          • #6
            Canvas.getIsPrinting() will return true