cancel
Showing results for 
Search instead for 
Did you mean: 

How to align Table cells

Former Member
0 Kudos

Hi

I want align data to top in particular columns

Actually i am adding multiple lines for some columns

for that the other cells pertaining to that row aligned centered.

for that reason i made column encode false and added <BR>

to other cells data

those are working fine

but i got problem with date columns in which because of <br> date field is converting into string and displaying entire date month day and time

i tried to use cellVAlignment in hbj:tableview

then it is throwing error stating that this element not

found in htmlb tags

please see my code

<hbj:tableView id="myTableView"

model = "myBean.model"

design = "ALTERNATING"

headerVisible = "true"

footerVisible = "false"

fillUpEmptyRows = "true"

navigationMode = "BYLINE"

headerText = "Leader Status OverView"

onNavigate = "onNavigation"

>

public Vector createLeaderStatusTableData(IRecordSet _hdrtable, IRecordSet _dattable) {

Vector dataVec = new Vector();

Vector retVector = new Vector();

IRecordSet hdrtable = _hdrtable;

IRecordSet datatable = _dattable;

String strtmpobjview = this.getObjview();

try{

hdrtable.beforeFirst();

while (hdrtable.next()){

if(!hdrtable.getString("DOC_APPRAISEE_NAME").trim().equals("")){

dataVec = new Vector();

if(strtmpobjview.equalsIgnoreCase("YES")){

String tmpitmstr = "<a href='somjunk'> <B>"hdrtable.getString("DOC_APPRAISAL_NAME")"</B></a>" ;

String tmpwtstr = "<B>"hdrtable.getString("DOC_WEIGHTING")"</B>" ;

String myspace = "<BR> ";

datatable.beforeFirst();

while (datatable.next()){

if(datatable.getString("APPRAISAL_ID").equals(hdrtable.getString("APPRAISAL_ID"))){

tmpitmstr=tmpitmstr"<BR>"datatable.getString("ITM_TITLE");

tmpwtstr=tmpwtstr"<BR>"datatable.getString("ITM_WEIGHTING");

myspace = myspace+"<BR> " ;

}

}

dataVec.addElement(hdrtable.getString("DOC_APPRAISEE_NAME")+myspace);

dataVec.addElement(hdrtable.getString("DOC_TRFGR")+myspace);

dataVec.addElement(tmpitmstr);

dataVec.addElement(tmpwtstr);

dataVec.addElement(hdrtable.getString("DOC_STATUS")+myspace);

dataVec.addElement(hdrtable.getDate("DOC_AP_START_DATE"));

dataVec.addElement(hdrtable.getDate("DOC_AP_END_DATE"));

}

else{

dataVec.addElement(hdrtable.getString("DOC_APPRAISEE_NAME"));

dataVec.addElement(hdrtable.getString("DOC_TRFGR"));

dataVec.addElement(hdrtable.getString("DOC_APPRAISAL_NAME"));

dataVec.addElement(hdrtable.getString("DOC_WEIGHTING"));

dataVec.addElement(hdrtable.getString("DOC_STATUS"));

dataVec.addElement(hdrtable.getDate("DOC_AP_START_DATE"));

dataVec.addElement(hdrtable.getDate("DOC_AP_END_DATE"));

}

retVector.addElement(dataVec);

}

}

}catch(Exception te){

}

return retVector ;

}

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sri,

You need to align cell by cell. You need to modify your JSP tage for tableView and add the following lines of java code.

<hbj:tableView id="myTableView"
model = "myBean.model"
design = "ALTERNATING"
headerVisible = "true"
footerVisible = "false"
fillUpEmptyRows = "true"
navigationMode = "BYLINE"
headerText = "Leader Status OverView"
onNavigate = "onNavigation">
<%
  for (int i=1; i <= 10 ; i++ )
  {
   myTableView.setCellHAlignment(i,1, CellHAlign.RIGHT)
   myTableView.setCellVAlignment(i,1, CellVAlign.TOP);
  }
%>
</hbj:tableView>

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi prakash,

I got the alignment

you code is very helpful to me

for this to execute importing CellVAlign class in jsp is must

My code is as below

<%@ page import = "com.sapportals.connector.execution.structures.*, com.sapportals.htmlb.enum.CellVAlign" %>

<hbj:tableView id="myTableView"

model = "myBean.model"

design = "ALTERNATING"

headerVisible = "true"

footerVisible = "false"

fillUpEmptyRows = "true"

navigationMode = "BYLINE"

headerText = "Leader Status OverView"

onNavigate = "onNavigation" >

<%for (int i=1; i <= myTableView.getRowCount() ; i++ ){

myTableView.setCellVAlignment(i,6, CellVAlign.TOP);

myTableView.setCellVAlignment(i,7, CellVAlign.TOP);

} %>

</hbj:tableView>