on 2006 Oct 12 8:22 AM
Hello folks,
I'm having some problems with adding a button to the row of a table whilst programming a JSPDynPage app.
Relevant JSP code
<hbj:tableView id="resultTable"
model="theBean.ResultModel"
design="alternating"
headerVisible="false"
footerVisible="true"
fillUpEmptyRows="false"
navigationMode="bypage"
selectionMode="none"
onNavigate="NavigateResultTable"
visibleFirstRow="<%=theBean.getFirstVisibleRow()%>"
visibleRowCount="8"/>
Relevant Java code
Button reg = new Button("But"+room.getId());
reg.setText("Register");
reg.setOnClick("RegisterUser");
currentRow.addElement(reg);
model.getColumn("Registration").setType(TableColumnType.BUTTON);
The problems are
i) Button text is not what I've set but the button object ID, com.sap.portals.htmlb.Button@xxxxxxx
ii) The event is not being raised onClick.
Any help greatly appreciated, thanks...
Patrick.
Hi Pratrick,
In this case,it is not possible to set the text of a button using <b>reg.setText("Register");</b>
It can be done using the vector. Use <b>vector.addElement("Register");</b>, while adding the data into the table.
Hope it helps.
Regards,
Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Saravanan,
Sorry for the delay in replying.
I'll be in the office on Sunday and give this a try.... won't it simply add the text "Register" to the table though? Or so long as I have an HTMLB element with ID 'Register' will it add the element??
I'll have a look in the morning and update.
Thanks Saravanan,
Patrick.
Hi Patrick,
Use this workaround:
When you fill your table, add the button's text as a simple string:
currentRow.addElement("Register")
-or-
currentRow.addElement("Unregister")
Next, to your default view model add the following code:
model.getColumn("Registration").setType(TableColumnType.BUTTON);
TableColumn buttonColumn = model.getColumn("Registration");
buttonColumn.setOnCellClick("onCellClick");
And finally, add the method onCellClick:
public void onCellClick(Event evt) {
TableCellClickEvent tcce = (TableCellClickEvent) evt;
int row = tcce.getVisibleRowIndex();
from the event you can get the visible row index, combind with firstVisibleRow from the bean you could get the relevant info from the data model.
Omri
User | Count |
---|---|
66 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.