TableView Customizing Problems
Hi all,
i`m trying to display a Table with a some columns and a selektor (radio button).
I have different tables with this setup, but i can`t set the width of the differnt cells. I tried via TableView getColumn("xx" and setWidth("100 px") or setWidth("50 %"); but without success.
Then i implemented an own CellRenderer. And it renders my cells, but i cannot influence the width of the TextView. (I have set the width AND set the wrapping attribute to true, to get the width repsected)
Ok, now i`m a little clueless.
How can i set the width of the different cells ?
In my simplest table i want to have a table with the radio button and one cell that spans the remaining row size.
Maybe someone can point me in the right directions or supply me some sample code.
Best Regards
Odo
Hi,
here is the code that i use to setup the tableView:
<hbj:tableView
id="tagTableView"
design="ALTERNATING"
headerVisible="true"
footerVisible="true"
fillUpEmptyRows="true"
navigationMode="BYPAGE"
selectionMode="SINGLESELECT"
visibleFirstRow="1"
visibleRowCount="5"
width="100 %" >
<%
tagTableView.setModel(tagTableBean.getTagTable().getModel());
tagTableView.useRowSelection(tagTableBean.getTagTable().getTableView());
tagTableView.setHeaderText("Defined Tags");
tagTableView.setOnNavigate("onTagNavigate");
tagTableView.setOnRowSelection("onTagRowSelection");
%>
I have tried to set the width of the column in the scriptlet but with no success.
com.sapportals.htmlb.table.TableView tv = (com.sapportals.htmlb.table.TableView)pageContext.findAttribute("tagTableView");
tv.getColumn(1).setWidth("100 %");
Hi,
the problem is solved. When a table has only two columns (one select box / radio button and one content column) the
img that is placed in the radio button column needs to have the size set (1x1). If not, the IE6 stretches this column and it looks ugly.
A workaround for this is to add an empty column and set the width of the middle column to max. Works and do not look that ugly.
Better solutions are welcome.
Best Regards,
Odo
Message was edited by: Oliver Dohmen
Similar Messages
-
Hi everyone.
I created a iOS tabbed application using xcode 4.2 and storyboard. I added one tableviewcontroller with custom cell on it, when clicking the row, I want to open one tableviewcontroller, i used the following code below
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
categoryClass *cc = [datas objectAtIndex:indexPath.row];
[tableView deselectRowAtIndexPath:indexPath animated:NO];
iSubProducts *subProducts = [[iSubProducts alloc] init];
subProducts.title = cc.categoryName;
subProducts.catID = cc.categoryID;
[[self navigationController] pushViewController:subProducts animated:YES];
[subProducts release];
but when I click the row it gives me the following error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath
on my iSubProducts tableviewcontroller, i have the following:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"myCell2";
iSubProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
productSubClass *cc = [datas2 objectAtIndex:indexPath.row];
NSLog(@"Product Name: %@", cc.productName);
cell.txtProductName.text = cc.productName;
cell.txtProductDesc.text = cc.productDesc;
return cell;
I assume this is where the error occurs, the cell is returning a nil value. When I try to attach the iSubProducts tableviewcontroller using or from a button, it all works fine, but if its coming from row clicked, this error shows up.
Im quite new with iOS development, and maybe there is a error opening tableviewcontroller from a tableviewcontroller with a custom cell on it. I've been bangin my head for 2 days now and googled a lot, unfortunately I didn't find any solution. I'm pretty sure there's no error on the iSubProducts tableviewcontroller since its working if i tried pushing it from a button. Please I need advice on this one, Im so stucked right now with this issue. Thank you everyone.Hi,
you need to create a tableViewCell in case the dequeueReusableCell-call doesn't return one.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"myCell2";
iSubProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = (iSubProductCell *)[[UITableViewCell alloc] init....
productSubClass *cc = [datas2 objectAtIndex:indexPath.row];
NSLog(@"Product Name: %@", cc.productName);
cell.txtProductName.text = cc.productName;
cell.txtProductDesc.text = cc.productDesc;
return cell;
Dirk -
Creating an ISP Bill for Customer Problem, What did i do wrong?
Ok so the point of this program is to create a bill for customers selecting different packages for this ISP. Now i have done all the code, made the methods and what now, but there is a problem, in my main method which tests the methods in my class, the object does not get passed through the method and my toString method does not return the output. i will post the code below, did i do anything wrong?
this is the code for the class:
public class Customer extends appProg
//these are the base set of hours for each package
public final double BASE_HOURS_A= 10.00;
public final double BASE_HOURS_B= 20.00;
public final double BASE_HOURS_C= 9999999999999999999999999999999999999999.00;
//these are the base costs for each package
public final double BASE_COST_A= 9.95;
public final double BASE_COST_B= 14.95;
public final double BASE_COST_C= 19.95;
//these are the additional costs per hour for the packages
public final double PER_HOUR_COST_A= 2.00;
public final double PER_HOUR_COST_B= 1.00;
public final double PER_HOUR_COST_C= 0.00;
private double totalCharges;
private char packageType;
private double hoursUsed;
private String customerName;
// Below are the Constructors for this class
// The constructors will help instantiate the object
public Customer()
{ totalCharges=0;
packageType='b';
hoursUsed=0.0;
customerName="";
public Customer(char packageType, double hoursUsed, String customerName)
this.packageType=packageType;
this.hoursUsed=hoursUsed;
this.customerName=customerName;
// The following are the accessor methods
// the getPackage method returns the package type
public char getPackage()
return packageType;
// the getHoursUsed() returns the hours used of the customer
public double getHoursUsed()
return hoursUsed;
// the getCustomerName() returns the name of the customer
public String getCustomerName()
return customerName;
//the totalCharges methods calculates the total charges
public double totalCharges()
if(packageType=='A' && hoursUsed>10.00)
totalCharges=((hoursUsed-10)*PER_HOUR_COST_A)+(hoursUsed*BASE_COST_A);
if(packageType=='A' && hoursUsed<=10.00)
totalCharges=(hoursUsed*BASE_COST_A);
if(packageType=='B' && hoursUsed>20.00)
totalCharges=((hoursUsed-20)*PER_HOUR_COST_B)+(hoursUsed*BASE_COST_B);
if(packageType=='B' && hoursUsed<=20.00)
totalCharges=(hoursUsed*BASE_COST_B);
if(packageType=='C')
totalCharges=(BASE_COST_A);
return totalCharges;
//The following are the mutator methods
//the setPackage method will set the package type for the customer
public void setPackage(char packageType)
this.packageType=packageType;
//the setHours method will set the amount of hours used for that customer
public void setHours(double hoursUsed)
this.hoursUsed=hoursUsed;
//the setCustomerName method will set the name for the customer
public void setCustomerName(String customerName)
this.customerName=customerName;
//the following are input and output methods
public String toString()
return "You have used a total of "+hoursUsed+" hours and your total cost is "+totalCharges+"";
} // end class Customerand this is the code for the appProgram that goes with it:
public class appProg
//************* MAIN METHOD ******************************************
public static void main(String[] args)
String packageT;
char packagetype;
double hoursUsed;
String name;
Scanner keyboard = new Scanner(System.in);
System.out.println("This program was written by Ashkan Gholami for CSC15 with JONES.");
System.out.println("");
System.out.print("Please enter the Customers name: ");
name=keyboard.nextLine();
System.out.print("Please enter the package type: ");
packageT=keyboard.nextLine();
packagetype=packageT.charAt(0);
System.out.print("Please enter the hours used: ");
hoursUsed=keyboard.nextDouble();
keyboard.nextLine();
switch(packagetype)
case 'A':
System.out.println(""+name+" has chosen package A.");
break;
case 'B':
System.out.println(""+name+" has chosen package B.");
break;
case 'C':
System.out.println(""+name+" has chosen package C.");
break;
case 'a':
System.out.println(""+name+" has chosen package A.");
break;
case 'b':
System.out.println(""+name+" has chosen package B.");
break;
case 'c':
System.out.println(""+name+" has chosen package C.");
break;
default:
System.out.println("That is an invalid package type!");
break;
Customer customer1= new Customer(packagetype,hoursUsed,name);
customer1.totalCharges();
customer1.toString();
}in my main method which tests the methods in my class,
the object does not get passed through the method That statement makes no sense. You can pass objects to methods. However, you do not pass objects "through methods". In any case, neither your totalCharges() method nor your toString() method is defined to accept any parameters--much less an object as a parameter.
and my toString method does not return the outputHow do you know that? Your toString() method is defined to return a String. Where in your program do you attempt to display the String that is returned?
did i do anything wrong?If you call a method on an object, and the method returns something, you need to assign the returned value to a variable--otherwise the returned value will disappear into the ether. Subsequently, if you want to display the returned value, you have to take steps to do that as well.
It sounds like you need to revisit a simple "Hello World" program and play around with it a little bit. -
I have been trying to get a tableview to be sortable by clicking on the header of columns. I have been reviewing existing threads on the forum in particular the one below.
https://forums.sdn.sap.com/thread.jspa?threadID=16417
I seem to understand the concept but for some reason my table does not sort, it just does nothing. Could someone take a look and see if you can find any problems - I can't wait to give points.
Here is all my code.
Here is the Java....
package MSSPackage;
import MSSBeanPackage.PositionOverviewBean;
import MSSPackage.SortTableModel;
import com.sapportals.htmlb.page.DynPage;
import com.sapportals.htmlb.page.PageException;
import com.sapportals.portal.htmlb.page.JSPDynPage;
import com.sapportals.portal.htmlb.page.PageProcessorComponent;
import com.sapportals.portal.prt.component.IPortalComponentContext;
import com.sapportals.portal.prt.component.IPortalComponentProfile;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentSession;
import com.sapportals.htmlb.event.*;
import com.sapportals.htmlb.*;
import com.sapportals.htmlb.table.*;
import com.sapportals.htmlb.table.DefaultTableViewModel;
import javax.servlet.http.*;
// SAP RFC Imports
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.JCO;
import com.sapportals.portal.prt.service.jco.IJCOClientPoolEntry;
import com.sapportals.portal.prt.service.jco.IJCOClientService;
import com.sapportals.portal.prt.runtime.PortalRuntime;
import java.util.*;
public class PositionOverview extends PageProcessorComponent {
public DynPage getPage(){
return new PositionOverviewDynPage();
public static class PositionOverviewDynPage extends JSPDynPage{
JCO.Repository mRepository;
public JCO.Table tblRelations;
public JCO.Table tblPositions;
public SortTableModel tableModel;
public int visibleRow = 1;
private boolean OrgUnitSelected = false;
public void doInitialization(){
IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
PositionOverviewBean oBean = new PositionOverviewBean();
// Table Start row
oBean.setvisibleRow(new Integer(this.visibleRow).toString());
oSession.putValue("myBean", oBean);
// Define request, context and profile containers
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
// Define bean reference to bean
PositionOverviewBean myBean = new PositionOverviewBean();
// Table Start row
myBean.setvisibleRow(new Integer(this.visibleRow).toString());
// Place bean in user profile.
myProfile.putValue("myBean", myBean);
public void doProcessAfterInput() throws PageException {
public void doProcessBeforeOutput() throws PageException {
String NavType = "RCORGUNIT";
String OType = "O";
//String OBjid = "10004399";
String OBjid = "";
String sapSystem = "SAP_R3_HumanResources";
IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
// Define request, context and profile containers
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
/* IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
//HttpSession session = request.getServletRequest().getSession(); //dmm
//Get Bean from Profile
PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
//PositionOverviewBean myDataBean = (PositionOverviewBean) session.getValue("POviewBean"); //dmm
String ddlbSelection = "";
String ddlbValue = "";
DropdownListBox ddlbOrgUnits = (DropdownListBox) getComponentByName("ddlbOrgUnits");
if (ddlbOrgUnits != null)
ddlbSelection = ddlbOrgUnits.getSelection();
ddlbValue = ddlbOrgUnits.getValueAsDataType().getValueAsString();
OBjid = ddlbValue;
myBean.setObjId(OBjid);
else
OBjid = "";
myBean.setObjId(OBjid);
IJCOClientService clientService;
IJCOClientPoolEntry poolEntry;
JCO.Client client;
try
clientService = (IJCOClientService) PortalRuntime.getRuntimeResources().getService(IJCOClientService.KEY);
poolEntry = clientService.getJCOClientPoolEntry(sapSystem, request);
client = poolEntry.getJCOClient();
// connect to SAP system, logon
client.connect();
// Create Jco Repository Object
mRepository = new JCO.Repository("R3USERMENU", client);
// Reset function object
JCO.Function function = null;
// Run RFC Module on SAP system
function = this.createFunction("HRWPC_GET_NAV_OBJECTS");
JCO.ParameterList input = function.getImportParameterList();
input.setValue("RCORGUNIT", "NAVTYPE");
client.execute(function);
tblRelations = function.getTableParameterList().getTable("RESULT_OBJEC");
myBean.setRowcnt(tblRelations.getNumRows());
if (tblRelations.getNumRows() != 0)
myBean.setOrgUnits(tblRelations);
if (ddlbOrgUnits == null)
// check to see if there is not a position id already assigned
tblRelations.setRow(0);
OBjid = tblRelations.getString("OBJID");
myBean.setObjId(OBjid);
//myBean.sTemp = OBjid;
// GET THE POSITION DETAILS
function = null;
input = null;
function = this.createFunction("Z_GET_POSITION_OVERVIEW");
input = function.getImportParameterList();
input.setValue(NavType, "NAVTYPE");
input.setValue(OType, "OTYPE");
input.setValue(OBjid, "OBJID");
client.execute(function);
tblPositions = function.getTableParameterList().getTable("RESULT_OBJEC");
myBean.setRowcnt(tblPositions.getNumRows());
tableViewFormat();
tableModel.setTesting("Startxxxx");
myBean.settableModel(tableModel);
//tableModel.setTesting("SSSS");
//myDataBean.settableModel(tableModel); //dmm
//session.setAttribute("POviewBean", myDataBean); //dmm
oSession.putValue("myBean", myBean);
//Release pool entry
poolEntry.release();
catch(Exception ex)
//name = ex.getMessage();
//String sTest = "this is a test";
//request.getComponentSession().putValue("Test", sTest);
//myProfile.putValue("Testx", sTest);
this.setJspName("PositionOverviewJSP.jsp");
public void getPositions()
String NavType;
String Root_Ot;
String Root_ObjId;
public void tableViewFormat()
// Define the vectors used to build tableView
Vector tempRec = new Vector();
Vector dataRec = new Vector();
String sDate = "";
String sPosLink = "";
String sPosVal = "";
String sENameLink = "";
String sENameVal = "";
String sStatus = "";
// Loop at company code list and add to vectors
for (int i = 0; i < tblPositions.getNumRows(); i++)
tblPositions.setRow(i);
tempRec = new Vector();
sStatus = (String) tblPositions.getString("STATUS");
if (sStatus != null)
if (sStatus.equals("0"))
sDate = tblPositions.getString("ZHR_VACANT_BEGDA");
sDate = sDate.substring(5, 7) + "/" + sDate.substring(8, 10) + "/" + sDate.substring(0, 4);
else
sDate = "";
sPosVal = tblPositions.getString("STEXT");
sENameVal = tblPositions.getString("ENAME");
if (sPosVal.equals(""))
sPosLink = sPosVal;
else
sPosLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.sap.portal.migrated/ep_5.0/pages/com.sap.pct.hcm.positionprofile?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("STEXT") + "</a>";
if (sENameVal.equals(""))
sENameLink = sENameVal;
else
sENameLink = "<a HREF="myLink" onclick="return EPCM.doNavigate('ROLES://portal_content/com.phi/com.phi.mgt/com.phi.mss/com.phi.hr/com.phi.pages/com.phi.mgt.mss.hr.pages.positionholder?CKey=000000" + tblPositions.getString("OBJID") + "', 1)">" + tblPositions.getString("ENAME") + "</a>";
tempRec.addElement(sStatus);
tempRec.addElement(tblPositions.getString("OBJID"));
tempRec.addElement(sPosLink);
tempRec.addElement(sENameLink);
tempRec.addElement(sDate);
dataRec.addElement(tempRec);
// Then define the technical column names
Vector colNames = new Vector();
colNames.addElement("STATUS");
colNames.addElement("OBJID");
colNames.addElement("STEXT");
colNames.addElement("ENAME");
colNames.addElement("ZHR_VACANT_BEGDA");
// Now we build the actual tableView
//tableModel = new DefaultTableViewModel(dataRec, colNames);
tableModel = new SortTableModel(dataRec, colNames, 5);
// Define tableView parameters
tableModel.setKeyColumn(2);
TableColumn column = tableModel.getColumn("STATUS");
column.setEncode(false);
column.setType(com.sapportals.htmlb.enum.TableColumnType.USER);
column.setTitle("Vacant");
column = tableModel.getColumn("OBJID");
column.setTitle("Position Number");
column = tableModel.getColumn("STEXT");
column.setTitle("Position");
column = tableModel.getColumn("ENAME");
column.setTitle("Holder of Position");
column = tableModel.getColumn("ZHR_VACANT_BEGDA");
column.setTitle("Vacant as of");
// * Navigation Button Clicked
public void myOnNavigate(Event event)
TableNavigationEvent tne = (TableNavigationEvent) event;
visibleRow = tne.getFirstVisibleRowAfter();
// Define request, context and profile containers
IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
IPortalComponentContext myContext = request.getComponentContext();
IPortalComponentProfile myProfile = myContext.getProfile();
// Get Bean from profile
PositionOverviewBean myBean = (PositionOverviewBean) myProfile.getValue("myBean");
// Table Start row
myBean.setvisibleRow(new Integer(this.visibleRow).toString());
public void onHeaderClick(Event event)
IPortalComponentSession oSession = ((IPortalComponentRequest)getRequest()).getComponentSession();
PositionOverviewBean myBean = (PositionOverviewBean) oSession.getValue("myBean");
TableHeaderClickEvent tne = (TableHeaderClickEvent) event; // get the event
SortTableModel tblModel = myBean.gettableModel();
//tblModel.sort();
int col = 3;
tblModel.sortByColumn(col);
myBean.settableModel(tblModel);
oSession.putValue("myBean", myBean);
// Create Function object for RFC Calls
public JCO.Function createFunction(String name) throws Exception
try
IFunctionTemplate ft = mRepository.getFunctionTemplate(name.toUpperCase());
if (ft == null)
return null;
return ft.getFunction();
catch (Exception ex)
ex.printStackTrace();
throw new Exception("Problem retrieving JCO.Function object");
public void onSelectddlbOrgUnits(Event event) throws PageException
OrgUnitSelected = true;
Here is the JSP
<%@ page import="com.sap.mw.jco.*" %>
<%@ page import="com.sapportals.htmlb.enum.*" %>
<%@ page import="MSSPackage.TableViewCellRenderer" %>
<%@ page import="com.sapportals.portal.prt.component.IPortalComponentRequest" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="com.sapportals.portal.prt.component.IPortalComponentContext" %>
<%@ taglib uri="tagLib" prefix="hbj" %>
<hbj:content id="myContext" >
<hbj:page title="PageTitle">
<hbj:form id="myFormId" >
<jsp:useBean id="myBean" scope="session" class="MSSBeanPackage.PositionOverviewBean" />
<hbj:gridLayout rowSize="1" columnSize="1" cellSpacing="1">
<hbj:gridLayoutCell columnIndex="1" rowIndex="1">
<hbj:textView id="ddlbLable" text="Select organizational unit to display positions" design="STANDARD" />
</hbj:gridLayoutCell>
<hbj:gridLayoutCell columnIndex="1" rowIndex="2">
<hbj:dropdownListBox id="ddlbOrgUnits" onSelect="onSelectddlbOrgUnits" selection="<%=myBean.getObjId()%>">
<%
JCO.Table org_units = null;
org_units = myBean.getOrgUnits();
for (int i = 0; i < org_units.getNumRows(); i++)
org_units.setRow(i);
String sUnit = org_units.getString("STEXT");
String Unit_Id = org_units.getString("OBJID");
%>
<hbj:listBoxItem key="<%=Unit_Id%>" value="<%=sUnit%>" />
<%
%>
</hbj:dropdownListBox>
</hbj:gridLayoutCell>
<hbj:gridLayoutCell columnIndex="1" rowIndex="3">
<hbj:textView id="listLable" text="To designate a vacant position, click the icon in the 'Create Form' column" design="STANDARD" />
</hbj:gridLayoutCell>
<hbj:gridLayoutCell columnIndex="1" rowIndex="4">
<hbj:tableView
id="myTableView"
headerVisible="true"
footerVisible="true"
fillUpEmptyRows="true"
selectionMode="NONE"
navigationMode="BYPAGE"
onNavigate="myOnNavigate"
visibleFirstRow="<%= myBean.getvisibleRow() %>"
visibleRowCount="5" >
<%
myTableView.setOnHeaderClick("onHeaderClick");
myTableView.setUserTypeCellRenderer(new TableViewCellRenderer());
myTableView.setModel(myBean.gettableModel());
myTableView.setColumnType(TableColumnType.LINK, 3);
myTableView.setColumnType(TableColumnType.LINK, 4);
%>
</hbj:tableView>
</hbj:gridLayoutCell>
</hbj:gridLayout>
</hbj:form>
</hbj:page>
</hbj:content>
Here is the BEAN
package MSSBeanPackage;
//import com.sapportals.htmlb.enum.TableColumnType;
import MSSPackage.SortTableModel;
import com.sapportals.htmlb.table.DefaultTableViewModel;
//import com.sapportals.htmlb.table.TableColumn;
//import com.sapportals.htmlb.table.TableView;
//import com.sapportals.htmlb.table.TableViewModel;
import com.sap.mw.jco.JCO;
import com.sap.mw.jco.JCO.Table;
public class PositionOverviewBean {
// public DefaultTableViewModel tableModel;
public SortTableModel tableModel;
public JCO.Table OrgUnits;
public String ObjId;
public String visibleRow;
public int rowcnt;
public String sTemp;
// Get and Set methods for table model
// public DefaultTableViewModel gettableModel() { return tableModel; }
// public void settableModel(DefaultTableViewModel tableModel) { this.tableModel = tableModel; }
public SortTableModel gettableModel() { return tableModel; }
public void settableModel(SortTableModel IntableModel) { this.tableModel = IntableModel; }
public JCO.Table getOrgUnits() { return OrgUnits; }
public void setOrgUnits(JCO.Table value) { this.OrgUnits = value; }
// Get and Set methods for visiblerow
public String getvisibleRow() { return visibleRow; }
public void setvisibleRow(String visibleRow) { this.visibleRow = visibleRow; }
public int getRowcnt() { return this.rowcnt; }
public void setRowcnt(int rowcnt) { this.rowcnt = rowcnt; }
public String getObjId() { return this.ObjId; }
public void setObjId(String value) { this.ObjId = value; }
Here is the sorting class
package MSSPackage;
import java.util.Collections;
import java.util.Comparator;
import java.util.Vector;
import com.sapportals.htmlb.table.DefaultTableViewModel;
public class SortTableModel extends DefaultTableViewModel implements Comparator {
//protected int currCol;
public int currCol;
protected Vector ascendCol; // this vector stores the state (ascending or descending) of each column
protected Integer one = new Integer(1);
protected Integer minusOne = new Integer(-1);
public String testing;
public SortTableModel()
super();
ascendCol = new Vector();
public SortTableModel(Vector vec)
super(vec);
ascendCol = new Vector();
public SortTableModel(Vector vec, Vector vec2, int numberOfColumns)
super(vec, vec2);
ascendCol = new Vector();
setSortOrder(numberOfColumns);
public int compare (Object v1, Object v2)
// the comparison is between 2 vectors, each representing a row
// the comparison is done between 2 objects from the different rows that are in the column that is being sorted
int ascending = ((Integer)ascendCol.get(currCol)).intValue();
if (v1 == null && v2 == null)
return 0;
else if (v2 == null)
{ // Define null less than everything.
return 1 * ascending;
else if (v1 == null)
return -1 * ascending;
Object o1 = ((Vector)v1).get(currCol);
Object o2 = ((Vector)v2).get(currCol);
// If both values are null, return 0.
if (o1 == null && o2 == null)
return 0;
else if (o2 == null)
{ // Define null less than everything.
return 1 * ascending;
else if (o1 == null)
return -1 * ascending;
if (o1 instanceof Number && o2 instanceof Number)
Number n1 = (Number)o1;
double d1 = n1.doubleValue();
Number n2 = (Number)o2;
double d2 = n2.doubleValue();
if (d1 == d2)
return 0;
else if (d1 > d2)
return 1 * ascending;
else {
return -1 * ascending;
else if (o1 instanceof Boolean && o2 instanceof Boolean)
Boolean bool1 = (Boolean)o1;
boolean b1 = bool1.booleanValue();
Boolean bool2 = (Boolean)o2;
boolean b2 = bool2.booleanValue();
if (b1 == b2)
return 0;
else if (b1)
return 1 * ascending;
else
return -1 * ascending;
else
// default case
if (o1 instanceof Comparable && o2 instanceof Comparable)
Comparable c1 = (Comparable)o1;
Comparable c2 = (Comparable)o2; // superflous cast, no need for it!
try
return c1.compareTo(c2) * ascending;
catch (ClassCastException cce)
// forget it... we'll deal with them like 2 normal objects below.
String s1 = o1.toString();
String s2 = o2.toString();
return s1.compareTo(s2) * ascending;
* This method sorts the rows using Java's Collections class.
* After sorting, it changes the state of the column -
* if the column was ascending, its new state is descending, and vice versa.
public void sort()
Collections.sort(dataVector, this);
//Collections.sort(dataVector);
Integer val = (Integer)ascendCol.get(currCol);
ascendCol.remove(currCol);
if (val.equals(one)) // change the state of the column
ascendCol.add(currCol, minusOne);
else
ascendCol.add(currCol, one);
public void sortByColumn(int column)
this.currCol = column;
sort();
public void setSortOrder(int numberOfColumns)
for (int i = 0; i < numberOfColumns; i++)
ascendCol.add(one);
public void setTesting(String inStr)
testing = inStr;
Any help would be greatly apprciated and rewarded...Hi Don,
be aware that after the method onHeaderClick(Event event) is executed the method doProcessBeforeOutput() is executed as well.
I look over your code and found the following:
1) In method onHeaderClick you sort the table model and store the table model in the bean
2) In method doProcessBeforeOutput() you create a new table model from scratch (in helper method tableViewFormat())and store it in the bean. Thus you overwrite the sorted model.
I suggest that you move the initial creation of the table model in method doInitialization(). Do not forget to store the created table in the bean. In method doProcessBeforeOutput() you retrieve the table model from the bean instead of creating a new one for every request.
Best regards,
Martin -
Consignment fill-up - Output Printing Problem - Z customizing problem
Dear Gurus,
I have customized and copied the following 2 sales documents types:
- OR
- KB
into ZSTA and ZKB
When I create a Sales Order using VA01 and ZSTA, and chose 1 material + 1 service, the printed invoice clearly shows 2 items for each one of them.
When I create a Sales Order using VA01 and ZKB, and again chose 1 material + 1 service, only the material appears on the invoice and not the service...
Does anyone has an idea about where the problem might come from?
Your help is greatly appreciated.
Thank you
Chris.Hello Lakshmipathi,
I give you more information if it might help you:
These are the item categories that have been created into the system for ZKB: (Consignment Fill-up)
ZKB TEXT TATX
ZKB LEIS ZTAW TAD
ZKB NORM ZKB1
These are the item categories that have been created into the system for ZSTA: (Standard order)
ZSTA TEXT TATX
ZSTA TEXT TAC TATX
ZSTA TEXT TAM TATX
ZSTA TEXT TAN TATX
ZSTA TEXT TANN TATX
ZSTA TEXT TAP TATX
ZSTA TEXT TAQ TATX
ZSTA 2 TAC TAM
ZSTA 2 TAC TAE
ZSTA 2 TAE TAE
ZSTA 2 TAM TAC
ZSTA 4 TAM TAC
ZSTA 4 TAC TAE
ZSTA 4 TAM TAM
ZSTA 5 TAO
ZSTA ALEN ALEN TAN
ZSTA ALES ALES TAN
ZSTA BANC TAB
ZSTA BANS TAS TAN TANN TAW
ZSTA DIEN TAX TAW
ZSTA DIEN TAN TAX
ZSTA ERLA TAQ
ZSTA ERLA TAP TAE
ZSTA ERLA TAQ TAE
ZSTA LEER TAU
ZSTA LEER TAQ TAZ
ZSTA LEIC TADC TAW
ZSTA LEIC TAN TADC TAW
ZSTA LEIH TAL TAN
ZSTA LEIH TAN TAL TAN
ZSTA LEIH TAX TAL TAN
ZSTA LEIS TAW TAD
ZSTA LEIS TAN TAW TAD
ZSTA LUMF TAP TAQ
ZSTA LUMF TAP TAN
ZSTA NLAG TAX TAW TAD
ZSTA NLAG TAN TAX TAW TAD
ZSTA NORM TAN TAP TAQ TANN
ZSTA NORM TAC TAE
ZSTA NORM TAE TAE
ZSTA NORM TAG TAN
ZSTA NORM TAM TAN
ZSTA NORM TAN TANN
ZSTA NORM TANN TANN KBN
ZSTA NORM TAP TAN
ZSTA NORM TAQ TAE
ZSTA NORM APO0 TAPA TAN
ZSTA NORM APO0 TAPN TANN
ZSTA NORM APO1 TAPA TAPN
ZSTA NORM APO1 TAN TAPA
ZSTA NORM APO1 TANN TAPN
ZSTA NORM APO2 TAPA TAN
ZSTA NORM APO2 TAPN TANN
ZSTA NORM APO3 TAPA ALES
ZSTA NORM CSEL TAN TAN
ZSTA NORM FREE TAN TANN
ZSTA NORM PSA1 TAPA
ZSTA NORM PSA2 TAPA TAN
ZSTA NORM PSEL TAX TAPS
ZSTA NORM PSHP TAX
ZSTA NORM SLSV TALS
ZSTA NORM SLSV TALS TAUL
ZSTA SAMM TAG TAN
ZSTA SAMM TAG TAN TAS TAB
ZSTA VOLL TAQ
ZSTA WERT TAW
ZSTA WERT TAN TAW
Please let me know what your thoughts are. Remember that the problem is that on the final invoice, we can only see the price for 1 or more selected materials in ZKB and no services at all.
Thank you
Chris. -
Hello,
I'm currently trying to learn some FXML and have at least 4 problems with the TableView component:
1) TableView shows some strange behavior after maximizing the window:
https://dl.dropbox.com/u/1030857/maximized.PNG
and minimizing it afterwards:
https://dl.dropbox.com/u/1030857/normalaftermax.PNG
When resizing (particularily making the window bigger) the unstyled table is visible too:
https://dl.dropbox.com/u/1030857/resizing.PNG
I set some some constraints on the columns and I am using the CONSTRAINED_RESIZE_POLICY and here is the FXML:
<TableView fx:id="taskTable" prefHeight="-1.0" prefWidth="-1.0" VBox.vgrow="ALWAYS">
<placeholder><Label text="" /></placeholder>
<columnResizePolicy><TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /></columnResizePolicy>
<columns>
<TableColumn text="Completed" minWidth="75" prefWidth="75" maxWidth="75" >
<cellValueFactory><PropertyValueFactory property="completed" /></cellValueFactory>
</TableColumn>
<TableColumn text="Task">
<cellValueFactory><PropertyValueFactory property="name" /></cellValueFactory>
</TableColumn>
<TableColumn text="Progress" minWidth="100" prefWidth="100" maxWidth="100">
<cellValueFactory><PropertyValueFactory property="progress" /></cellValueFactory>
</TableColumn>
</columns>
<items>
<FXCollections fx:factory="observableArrayList">
<Task completed="false" name="Random" progress="0" />
<Task completed="false" name="Srandom" progress="3" />
<Task completed="true" name="Andom" progress="5" />
</FXCollections>
</items>
</TableView>The TableView Control sits in a VBox which sits in the center of a BorderPane.
2) I have found some code to hide the table header:
Pane header = (Pane) table.lookup("TableHeaderRow");
header.setVisible(false);
table.setLayoutY(-header.getHeight());
table.autosize();but I don't know where I can call it. I have a controller for the Main Window and if I use the Initializable interface I obviously get NullPointerException, because the TableView isn't created yet.
3) Is it possible to remove the resize lines / column borders? I tried changing CSS of the column-resize-line substructure of the TableView, but with no success...
4) I haven't found anything reliable on the net: How can I set a Checkbox Cell Factory in the table using FXML? I did it earlier using DataFX cell factories, but only in pure Java.
Kind regards,
Danieli solved this problem by creating a CustomTableView which extends from TableView and setting columnResizePolicy="CONSTRAINED_RESIZE_POLICY" in constructor.
-
Hi all,
I am customizing ALE Between two servers : sand ( client 900 ) and vat ( Client 600 ).
I want to transfer material from sand to vat.
I have made ports and RFC Destination as required on both the servers.
Ports and RFC Configuration on Sand is as follows :
RFC Destination name : VAT600
PORT Name : VAT600
Ports and RFC Configuration on VAT is as follows :
RFC Destination name : SANCLNT900
PORT Name : SANCLNT900
SANCLNT900 is the logical name of the client 900 of sand server.
VAT600 is the logical name of the client 600 of VAT server
Customer distribution model is also made on the sand server.
Partner profile on sand server is as follows :
Name : VAT600 ( logical name of the vat server ).
O/B Parameter : matmas
Partner profile on vat server is not made . I think it has to be made after distributing the model to the vat server.
Now when i try to distribute the Customer distribution model from Sand to vat server , the system gives following error :
RFC destination for synchronous communication (message type SYNCH)
Partner profile LS VAT600 SYNCH does not exist.
Generate partner profile
or specify outbound partner profiles for message type SYNCH
Please tell me where I am wrong.
I dont know how to overcome this problem.
Please help me.
Thanks and regards
Gurpreet Singhhi,
i thing you need to set the partner profile in the VAT ( client 600 ) also before you distribute the Customer distribution model in clien 900
cheers,
sasi -
Htmlb:TableView title problem
Hello,
recently we installed some support packages (now at SP59). After the installation my TableView titles are not shown correctly. Before the installation the titles were displayed completely, now after the installation the width of the column is only determined by the shown values in the columns.
The problem I have now is that vor a column which only contains the values A or B, the title "Status" is not shown. Any suggestions?
ALEXIf you are using an iterator,
use the method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS
there you can edit the width of your columns:
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <tv_column>.
<tv_column>-columnname = c_type.
<tv_column>-sort = c_x.
<tv_column>-title = c_energy_type.
<tv_column>-disable_filter = c_x.
<tv_column>-edit = '1'.
<tv_column>-width = 15.
grtz
Koen
Message was edited by: Koen Labie -
Hi,
I use Java FX 2.2 version and I have a problem with TableView refreshing. I am writing this post because I have not found any clear solution, but I know that there is a few post about this. Below is my pseudocode:
table.getItems().clear();
ObservableList<Entity> entities = {getting list of entities from DB}
table.setItems(list of entitites);The code works with Java FX 2.0.2 version but after upgrade to new version it does'nt work. I am getting new portion of data from db and replace list but table rows doesnt refresh.
I have been searching the solution for hours, but nothing works. It is a bug?
Edited by: user12049238 on 2012-06-12 14:24Below is my simple test case. When you click refresh data in the table does not change, but when you make column name invisible and the next visible data will change.
public class TestCase extends Application {
public static void main(String[] args) {
launch(args);
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Test case");
primaryStage.setX(0);
primaryStage.setY(0);
Button refreshButton = new Button("Refresh");
final TableView<Person> table = new TableView<>();
table.setTableMenuButtonVisible(true);
TableColumn c1 = new TableColumn("Id");
TableColumn c2 = new TableColumn("Name");
c1.setCellValueFactory(new PropertyValueFactory<Person, Long>("id"));
c2.setCellValueFactory(new PropertyValueFactory<Person, String>("name"));
table.getColumns().addAll(c1, c2);
refreshButton.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
table.getItems().clear();
List<Person> person = getPerson2();
table.setItems(FXCollections.observableList(person));
BorderPane pane = new BorderPane();
pane.setCenter(table);
pane.setBottom(refreshButton);
primaryStage.setScene(new Scene(pane, 400, 400));
primaryStage.show();
List<Person> person = getPerson1();
table.setItems(FXCollections.observableList(person));
private List<Person> getPerson1() {
List<Person> p = new ArrayList<>();
Person p1 = new Person();
p1.setId(1l);
p1.setName("name1");
Person p2 = new Person();
p2.setId(2l);
p2.setName("name2");
p.add(p1);
p.add(p2);
return p;
private List<Person> getPerson2() {
List<Person> p = new ArrayList<>();
Person p1 = new Person();
p1.setId(1l);
p1.setName("updated name1");
Person p2 = new Person();
p2.setId(2l);
p2.setName("updated name2");
p.add(p1);
p.add(p2);
return p;
public class Person {
private Long id;
private String name;
public Long getId() {
return id;
public void setId(Long id) {
this.id = id;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
if (getClass() != obj.getClass()) {
return false;
final Person other = (Person) obj;
if (this.id != other.id) {
return false;
return true;
@Override
public int hashCode() {
int hash = 7;
hash = 89 * hash + (int) (this.id ^ (this.id >>> 32));
return hash;
}What is the way to create new Jira issue? Could you help me? -
I am working on a business type ordering table. Each item in the table has several common properties that are displayed in the table. Also, each item has a collection of arbitrary properties. I would like to create a custom row that can be expanded to show a free form list of all custom properties below the normal row cells that display the common properties. The expanded section would just be a single control that spans the entire width of the table filled with text.
The docs say that a row factory can be used in this case, but contains no further info, tips or examples. I couldn't find any examples of custom rows on the web. I have looked at the implementation code, but it is not clear how to go about changing behavior in an efficient manner.
Any tips or examples?
ThanksHi,
you need to create a tableViewCell in case the dequeueReusableCell-call doesn't return one.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
static NSString *CellIdentifier = @"myCell2";
iSubProductsCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
cell = (iSubProductCell *)[[UITableViewCell alloc] init....
productSubClass *cc = [datas2 objectAtIndex:indexPath.row];
NSLog(@"Product Name: %@", cc.productName);
cell.txtProductName.text = cc.productName;
cell.txtProductDesc.text = cc.productDesc;
return cell;
Dirk -
HTMLB: tableview filter problems
Hi,
We developed a BSP application in CRM Web_IC. Whenever user goes to this screen, it retrieves the results from SAP CRM table and lists the entries. We used htmlb:tableview with filter attribute set to 'SERVER'. The first row of the entry is used to filter the entries displayed based on wildcard search and redisplay the same.
We noticed that all this handled by client side eventing (Java Script) and it works okay in our development and testing environment.
But we got wierd results when it went for user testing. On some of the machines, the page looks refreshed but the list display does not change based on the search. We thought it might be caching problem so we tried with different IE settings, it looks okay for some time on one of the machines but the problem gets repeated after wards. The situation is we cannot afford intermittent problems.
OS are win'2000 and XP and browser is IE 6 with sp1 and sp2. The problem is not consistent so none of the combinations actually suggested if the problem is related to one area.
Has anyone experienced similar to above. Any ideas are welcome.
Message was edited by: Raju DatlaThanks Rainer,
Without making any changes, today majority of the users are did not encounter the problem. I could not check the browser server cache settings as the BSP is using MVC and these fields are missing.
Thanks and Regards,
Raju
I lost how to add points. I remember there was a document on how to add points, which I could not get by search. Could you help me how I can award points to you.
Sorry for that and Thanks
Message was edited by: Raju Datla -
ICWC htmlb:tableview filter problems
Hi,
We developed a BSP application in CRM Web_IC. Whenever user goes to this screen, it retrieves the results from SAP CRM table and lists the entries. We used htmlb:tableview with filter attribute set to 'SERVER'. The first row of the entry is used to filter the entries displayed based on wildcard search and redisplay the same.
We noticed that all this handled by client side eventing (Java Script) and it works okay in our development and testing environment.
But we got wierd results when it went for user testing. On some of the machines, the page looks refreshed but the list display does not change based on the search. We thought it might be caching problem so we tried with different IE settings, it looks okay for some time on one of the machines but the problem gets repeated after wards. The situation is we cannot afford intermittent problems.
OS are win'2000 and XP and browser is IE 6 with sp1 and sp2. The problem is not consistent so none of the combinations actually suggested if the problem is related to one area.
Has anyone experienced similar to above. Any ideas are welcome.Hi Sasi,
Unfortunately I could not get any direct solution to the problem. I chased SAP OSS and SAP direct consultant who was working with us with no solution. Last time, I heard it was sent to htmlb team at SAP. I stopped chasing after that as project gone live and I fixed the problem by putting a search area and button using client side eventing.
If you read the source code once the page is displayed, you can see that SAP writes Javascript to handle the search. I copied the code as Javascript function and placed a button to fire this function which handles the filter as normally SAP does.
Regards,
Raju -
GRC 10.0 Workflow customizing problem
Hi experts,
We are working with GRC Access Control 10.0 and when doing the customizing tasks related with workflows we have an issue that doesnt let us continue.
Here is the background information.
We are in the "IMG/Governance Risk and Compliance/General Settings/Workflow/Perform Automatic Workflow Customizing" or easiest, we are in transaction code SWU3.
Here we have: Maintain Runtime Environment, all green, Maintain Definition Environment, all green, Maintain Additional Settings and Services, a red cross :(.
So, when opening the tree of our red cross task, we find that the only task that is with a red cross is "Maintain Web Server".
So, we execute the task, and here we have the following information:
Service = Webflow (Internet)
Address web server = http://<our web server>:8000/
Protocol Address = HTTP
Path of service = sap/bc/workflow_xml/?
URL = http://<our web server>:8000/sap/bc/workflow_xml/?
And here is something that kept our attention. When we push the button to test the URL, our IE opens a page but it is in blank (it doesnt show anything).
As we saw that, we thought that the service was not active and so went to transaction SICF and checked it, and yes, when you test the service, it doesnt work.
We finally, checked support packages upgrades and went to SP5 in our GRC server and SP5 in both plugins in our SAP ERP server.
And, here we are. Have no idea what else to do or check.
Any suggestion?
Thanks very much in advance.Hi,
I have just checked my SICF settings and found that we have not actually activated those services at all and our NWBC sessions work fine now.
Have you activated the sap/bc/nwbc and sap/bc/webdynpro services?
Also, have you activated the required BC sets for the standard content on Access Controls? This removes the need to do a lot of the basic setups but you still need to follow through the event linkages to check the successful generation etc.
Simon
Edited by: Simon Persin on Sep 21, 2011 5:51 PM -
Dynamic Table in Tableview Download Problem
Hello,
I've got a Problem with a dynamic displayed table in a field-symbol. Table is displayed and all that works fine, but when I try download this table into Excel (via Button), the field symbol in the Processing event is initial and data reference is also initial, so there is nothing to dereference. The field symbol is filled in OnInitialization Event and ref to data element is set. Can anyone help please?
Greetings
JoergHi Joerg,
is yor BSP statefull or not ?
Regards,
Fabri -
Dear All,
I have created import PO of 100 Nos. Vendor has send 100 Nos.
To receive it I need to pay to cusotms, hence I have done MIRO for Customs commisionarate for 100 Nos where it is debiting for 100 Nos.
At the time of GR, I found only 80 Nos balance are in transit loss. Hence I am doing MIGO for 80 Nos.
At this time Customs clearing account is Crediting for 80 Nos only.
Due to this Customs clearing account is kept Crediting balance for balance 20 Nos hence it is not knocking off. As I paid to customs I can't able to claim back.
How to solve this?
Rgds
Sriniresolved hence closed
Maybe you are looking for
-
I am having trouble downloading purchased songs to my iphone. I keep getting an error message that the song could not be downloaded. Why? How do I fix this?
-
Occi problem about object cache!
Hello! I have a table named "ggg" which include two column in the oracle database,and the datatype of one colume is "mdsys.sdo_geometry".I insert 1000000 rows record into the "ggg" table.Now I want to download all the data with occi.At the client,i u
-
Understanding OSMF layouts?
hi- im a seasoned actionscript developer but just starting out with osmf. i am having trouble understanding how layouts and layout rendering works. i have a control bar with all of my ui controls. i also have a 'share' button/panel that i want to liv
-
Playback problems with USB in vehicle.
Hello hope someone can help! I have just got a new iMac and am starting to send music to my usb flash drive that I was previously using on a PC and when I add the new files to the usb flash drive my songs scroll through the new ones and then play. So
-
IT2001 (Absences) No quota available
Hi SAP Guru's, Well when ever i pick the quota(paid leave) for any hourly employee it gives me the error "No quota availabe for att/abs 0100 for per no. XXXXXX between - (Date) and - (Date)" Can someone please make it easy for me by showing h