You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Wahyu Nengsih <wy...@nwa.iao.co.id> on 2003/08/07 05:08:02 UTC
about table
hi all
i want to ask how to render again in table.
if there's process delete n i want to show again in the table without
record was deleted.how can i resolve this problem?
my application is like workbench application but it was still show all
record eventhough some record was deleted.
could anybody help me?
best wishes,
wahyu
Re: about table
Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
What I did was the following (probably it can be more efficient but for
now it will suffice):
- Every object in the table is represented in an objRowMap (could prob
be something pagebound as well)
- When row/ obj is deleted you can remove it from the map, get the obj
from the map and remove the obj from the db as well (if a db delivers
you the data) also remove the row from the current TableDataModel
- The table is now ok
- There is always the infamous multi-user discussion re. the above
behaviour so I won't go there.
- The table now redraws itself without the deleted object
- Done (or so it is in my code)
Following a code snippet concerning the deleteRow action:
The rows are determined through a checkbox or a link
/**
* Generates the context that will be passed to the deleteRow()
listener if a "remove" link is selected.
* This is used by the Block rendering the 'Delete' column.
* @return String[] the context for the deleteRow() listener
*/
public String[] getDeleteRowContext() {
Object objRow = getCurrentRow();
return new String[] { objRow.toString() };
}
/**
* A listener invoked when a "remove" link is selected.
* It removes from the data model the row corresponding to the link.
* @param objCycle the request cycle
*/
public void deleteRow(IRequestCycle cycle) {
Object[] arrParams = cycle.getServiceParameters();
Object o = _objectLinkMap.get(arrParams[0]);
// Remove or do what you have to do from a dataSource perspective
if (o instanceof PersistentDCG) ((PersistentDCG) o).delete(((Visit)
cycle.getEngine().getVisit(cycle)).getUser());
// Remove the row from the current TableDataModel
((SimpleListTableDataModel) ((SimpleTableModel)
getTableModel()).getDataModel()).removeRow(o);
// Remove the row from the temporary map
_objectLinkMap.remove(arrParams[0]);
}
Good luck,
Fermin DCG
Wahyu Nengsih wrote:
>hi all
>
>i want to ask how to render again in table.
>if there's process delete n i want to show again in the table without
>record was deleted.how can i resolve this problem?
>my application is like workbench application but it was still show all
>record eventhough some record was deleted.
>could anybody help me?
>