Announcement

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

    ListGrid - Is it possible to shorten field content ?

    Hi,

    i have fields in ListGrid that contain long Texts set outside the listGrid via a richTextItem.

    Is it possible to only show first 24 characters from the text in the field ?

    Thanks!

    The problem is that the listGrid then expand every row height to contain every line from the text (while maintaining small width) - e.g. if i have 3 new lines in the text, it will display 3 rows within the cell. All i want to do is to keep the record heights fixed @ whatever height but nothing seems to work. Its ok for me just to display the first 24 characters.
    Last edited by mpet; 14 Dec 2010, 09:42.

    #2
    Anyone ? Its not a hard one..

    Comment


      #3
      I've used
      Code:
      listgrid.setWrapCells (true);
      to let the cell value span vertically leaving the row height fixed.
      You could also use
      Code:
      listgrid.setFixedRecordHeights (true)
      or use a cell formatter to truncate the string using StringUtil.abbreviate()
      i.e.
      Code:
      import com.smartgwt.client.util.StringUtil;
      ...
      listGridField.setCellFormatter (new CellFormatter () {
        @Override
        public String format (final Object value, final ListGridRecord record, final int rowNum, final int colNum) {
          return StringUtil.abbreviate ((String)value, 24)
        }
      });
      Cheers
      Davide

      Comment


        #4
        Indeed, I think it would be very interesting to have a way to dynamically show the ellipsis (the "...") at the end of the visible cell value when it doesn't fit the cell room (hence being clipped). Till now I've not found a way to get it.

        Any idea?
        smartgwt.dev?

        Comment


          #5
          I'm looking for the exact same feature as d.cavestro descripes.

          Anyone come up with a solution?
          Isomorphic, any comments?

          Comment


            #6
            Hi all

            This is also my problem , i want to show abc... when the width of the column
            is less than the width of the text ??

            Comment

            Working...
            X