We use a p:datatable inside a p:dialog.
We encountered two major problems when selecting table rows we could fix by patching the JS for the datatable only.
a) Event bubbling for the JQuery "live" events:
The events for the selection seem not to be stopped in the selection event handler (the rows are not selected due to the fact the handler is called multiple times in this case).
We added:
Code: Select all
.live(selectEvent, function(event) {
// added return
return _self.onRowClick(event, this);
});
onRowClick = function(event, rowElement) {
//Check if rowclick triggered this event not an element in row content
if(jQuery(event.target).is('td,span')) {
...
// add false for selection events
return false;
}
// continue otherwise
return true;
}
Our dialog is rerendered using ajax. This caused the addition of a new live-event handler for each call.
We solved this issue by adding:
Code: Select all
$(this.jqId + ' .ui-datatable-data tr').die();
Are there other solutions to solve this issues than patching the JS?
TIA, Daniel
PrimeFaces 2.2R C2
Mojarra 2.0.2
GlassFish 3.0.1