tags:

views:

88

answers:

2

I have a project showing comments database
I put the comments in FlexTable TabelKomen and I put the text in HTML format like this:

private static final int y=1;

public void UpdateTabelKomen(JsArray str){ 
 for(int i=0; i str.length(); i++){     
  UpdateTabelKomen(str.get(i)); 
}
}

public void UpdateTabelKomen(ImageDetailData str){
   TabelKomen.setWidget(y, 0, new HTML(str.getmember + "'s comment :" + str.getkomen()));
   TabelKomen.getFlexCellFormatter().setWordWrap(y, 0, true);
   y++;
}

The data was shown, but my text comment is not word wraped and make my flex table wider. Of course that will ruin my web appearance.
I change new HTML with new ScrolPanel(new HTML) seems not working.
so
How can I Format my FlexTable? is there any option beside flextable or scrollpanel?

A: 

Is it possible that y has the wrong value here? A better way to do this is to get rid of the variable y and use FlexTable#getRowCount, like so:

public void UpdateTabelKomen(ImageDetailData str){
   int row = TableKomen.getRowCount();
   TabelKomen.setWidget(row, 0, new HTML(str.getmember + "'s comment :" + str.getkomen()));
   TabelKomen.getFlexCellFormatter().setWordWrap(row, 0, true);
}
aem
y value replaced by getRowCount() the result is same. setwordwrap seems not affecting the cell.
+1  A: 

well, looks like that a silly question. its not wrapped because my string is wkwkwkwk.... with no space. its already auto wordwrapped in the flextable. hahah! thanks anyway.

Since your answer is the solution, you should accept it instead of mine.
aem