Skip to Content
0
Former Member
Mar 23, 2007 at 08:57 AM

problem in onNavigate attribute

30 Views

hai professionals,

i used tableview tag presents in the htmlb to create a table view.i got the output also succesfully.

but my navigation button in the output is not working.i have created 9 records in my table.during the output it will show the first 5 at first and if press the navigate button it should show the remaining.but it again shows the same 5.

my code is given below

-


TableViewSample.java:

package com.tec;

import com.tec.TableViewBean;

import com.sapportals.htmlb.event.Event;

import com.sapportals.htmlb.event.TableNavigationEvent;

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

import com.sapportals.htmlb.table.TableView;

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;

public class TableViewSample extends PageProcessorComponent {

public DynPage getPage(){

return new TableViewDynPage();

}

public static class TableViewDynPage extends JSPDynPage{

public TableView table;

TableViewBean myBean;

private int visibleRow = 1;

public void doInitialization(){

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

IPortalComponentContext myContext = request.getComponentContext();

IPortalComponentProfile myProfile = myContext.getProfile();

TableViewBean myBean = new TableViewBean();

myContext.putValue("myBeanName", myBean);

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

this.setJspName("TableViewJsp.jsp");

}

public void myOnNavigate(Event event) throws PageException {

TableNavigationEvent tne = (TableNavigationEvent) event;

this.visibleRow = tne.getFirstVisibleRowAfter();

if (myBean != null) {

myBean.setVisibleFirstRow(new Integer(this.visibleRow).toString());

}

}

}

}

-


TableViewBean.java:

package com.tec;

import java.io.Serializable;

import com.sapportals.htmlb.table.DefaultTableViewModel;

import com.sapportals.htmlb.table.TableColumn;

import com.sapportals.htmlb.table.TableView;

public class TableViewBean implements Serializable {

public String design;

public String headerVisible;

public String footerVisible;

public String fillUpEmptyRows;

public String navigationMode;

public String selectionMode;

public String headerText;

public String visibleFirstRow="1";

public String visibleRowCount;

public String rowCount;

public String tableWidth;

public DefaultTableViewModel model;

private TableView oldtableview;

/*public TableView getOldTableView() {

return this.oldtableview;

}

public void setOldTableView(TableView table) {

this.oldtableview = table;

}*/

public DefaultTableViewModel getModel() {

return model;

}

public void setModel(DefaultTableViewModel model) {

this.model = model;

}

public String getVisibleFirstRow() {

return visibleFirstRow;

}

public void setVisibleFirstRow(String visibleFirstRow) {

this.visibleFirstRow = visibleFirstRow;

}

public TableViewBean() {

String[][] data = createData();

String[] colNames = {"LASTNAME", "FIRSTNAME", "STREET", "ZIP", "CITY"};

model = new DefaultTableViewModel(data, colNames);

model.setKeyColumn(1);

TableColumn column = model.getColumn("LASTNAME");

//column.setOnCellClick("onMyOnCellClick");

column.setTitle("Last Name");

column = model.getColumn("FIRSTNAME");

//column.setOnCellClick("onMyOnCellClick");

column.setTitle("First Name");

column = model.getColumn("STREET");

//column.setOnCellClick("onMyOnCellClick");

column.setTitle("Street");

column = model.getColumn("ZIP");

//column.setOnCellClick("onMyOnCellClick");

column.setTitle("ZIP - Code");

column = model.getColumn("CITY");

//column.setOnCellClick("onMyOnCellClick");

column.setTitle("City");

}

private String[][] createData() {

String[][] retVal = {

{"Backer", "Melissa", "528 34th Ave", "94121", "San Francisco"},

{"Hamilton", "Ann", "4752 17th St", "94117", "San Francisco"},

{"Hudson", "Bree", "16 Hudson Ct", "94124", "San Francisco"},

{"Watson", "David", "168 Cervantes Blvd", "94123", "San Francisco"},

{"Eastwood", "Kenneth", "3367 Troy Dr", "90068", "Los Angeles"},

{"Peter", "Smith", "524 Arvin St", "93308", "Bakersfield"},

{"Antony", "Miller", "10430 Wilshire Blvd", "90024", "Los Angeles"},

{"Moore", "Roger", "1815 W 82d", "90001", "Los Angeles"},

{"Jackson", "Michael", "3450 Sawtelle Blvd", "90066", "Los Angeles"}

};

return retVal;

}

}

.......................................................................................................................

TableViewJsp.jsp:

<%@ taglib uri= "tagLib" prefix="hbj" %>

<jsp:useBean id="myBeanName" scope="application" class="com.tec.TableViewBean" />

<hbj:content id="myContext" >

<hbj:page title="PageTitle">

<hbj:form id="myFormId" >

<hbj:tableView id="myTableView"

model="myBeanName.model"

design="ALTERNATING"

headerVisible="true"

footerVisible="true"

fillUpEmptyRows="true"

navigationMode="BYLINE"

selectionMode="NONE"

headerText="TableView example 1"

onNavigate="myOnNavigate"

visibleFirstRow="<%= myBeanName.getVisibleFirstRow() %>"

visibleRowCount="5"

width="500 px"

>

</hbj:tableView>

</hbj:form>

</hbj:page>

</hbj:content>

-


if anybody knows solution for this please tell me.....

regards,

ajoy