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

  • Appending HTML to HTMLPane

    Hello there, I'm currently stuck with trying to append HTML to the HTMLPane object. I know of the two methods:

    getContents and setContents however the issue I have is that if I were to do:

    setContents(getContents() + "hello")
    The content would not really be appended, it would re set the data in the HTMLPane which is not what I want due to:

    'The application I am developing is a simple log file that is retrieving remote data and appending it to a front end. The user can then just scroll through the text already there and then select parts they need.'

    Right now if I were to use what I posted above, the selection made by the user would be removed every time the setContents was called. I am looking for something similar to VerticalPanel where I can just add the html however I've tried this already and after appending the VerticalPanel object to a Window object I am unable to select the text even with the method 'setCanSelectText(true)'.

    Any help would be greatly appreciated,

    Many thanks


  • #2
    You need to be setting canSelectText in the right place, not on the Window as a whole (which would include the header and icons), but just on the element where selection is allowed.

    So two options:

    1. when you add a plain GWT widget to a SmartGWT container it's auto-wrapped with a WidgetCanvas. You can wrap it yourself and setCanSelectText() on the WidgetCanvas.

    2. subclass Canvas and override getInnerHTML() to return a DIV or other element with a known ID, and then use GWT's low-level DOM manipulation APIs to manipulate it's content.


    • #3

      Thankyou for the quick reply, I'll work on this when I am back home.


      • #4
        Having trouble

        Hello there, I thought I'd leave it a while before posting again so I'd have enough time to try out and implement the second option.

        Unfortunately I'm not really understanding too well how to actually get the ID of the inner DIV of the HTMLPane/Flow. I know the DOM methods available in GWT and I have enough knowledge in java to understand subclassing.

        Any further advice would greatly be appreciated!

        Best regards,