user315196
user315196

Reputation: 119

GWT formating flextable & Panel create on the fly

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?

Upvotes: 0

Views: 870

Answers (2)

user315196
user315196

Reputation: 119

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.

Upvotes: 1

aem
aem

Reputation: 3916

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);
}

Upvotes: 0

Related Questions