cancel
Showing results for 
Search instead for 
Did you mean: 

Table column width restriction ("Big te..." instead of "Big text here").

Former Member
0 Kudos

I have a big string - 200 symbols for instance, but i want to display only beginning of it and replace ending by dots, so to have instead of column:

abcsdfdsfsdf

qwesdhfghdfgh

cvhbxcvbcvbc

this one:

abcsdf...

qwesd...

cvhbxc...

Accepted Solutions (0)

Answers (2)

Answers (2)

siarhei_pisarenka3
Active Contributor
0 Kudos

Hi Denis

Create calculated attribute 'cuttedDescription' and simple attribute 'cuttedDescription_cache'. Let me suppose 'description' keeps your original value for cutting. Put the following code into a getter:

  public java.lang.String getCuttedDescription(IPrivateTableView.ITableItemElement element)
  {
    //@@begin getCuttedDescription(IPrivateTableView.ITableItemElement)
    String value = element.getCuttedDescription_cache();
    if (value == null) {
		value = element.getDescription();
		if (value == null) {
			value = "";
		}
		if (value.length() > DESCRIPTION_LENGTH + 3) {
			value = value.substring(0, DESCRIPTION_LENGTH) + "...";
		}
		element.setCuttedDescription_cache(value);
    }
    return value;
    //@@end
  }

BR

Sergei

Former Member
0 Kudos

Siarhei, as i got correctly i will have the same problem as i described in the previous post:

wwwww...

iiiii...

both strings contains 5 symbols but are not equel in length.

lajitha_menon
Contributor
0 Kudos

Hi Denis,

Is the column field a text view?

Then you can try changing the 'design' to <b>monospace</b> after implementing the suggested code changes.

See if it puts all characters in equal width..

Regards,

LM

Former Member
0 Kudos

Yes, text view.

I've set 'design' to monospace - it works but <b>has other font</b>,and compress big string so that its very <b>hard to read</b> it.

So any other solutions are welcome.

roberto_tagliento
Active Contributor
0 Kudos

I guess you have to do yourself.

ADD an attrbute "shortTEXT", good if calculated VALUE.

and to

something like this

public void setYOUR_NODE_ShortTEXT(.... element, java.lang.String value)

{

//@@begin setColumnSelezionatiShT(IPrivateElencoCampi.IColumnSelezionatiElement, java.lang.String)

element.setShortTEXT = element.getLONGTEXT().substring(0,5) + " .... ";

//@@end

}

And bind it to VIEW TABLE UI.

Message was edited by:

Roberto Tagliento

Former Member
0 Kudos

Not exactly what i want. Look, in this case string length depends on symbols lengths. we can have using substring(0,n):

wwwww...

iiiii...

but should be:

wwwww...

iiiiiiiiiiiiiii...

Message was edited by:

Denis Lapanik