Search code examples
javascriptprimefaces

Primefaces DataTable - override onRowClick


I would like to ovveride the the onRowClick function for a specific DataTable. I have already done it with a tree and it's working. In this case the selection is broken and I don't see the reason.

Here my simple code:

PF('myTableWidget').onRowClick = function (event, rowElement, silent) {
    //do some stuff
    PrimeFaces.widget.DataTable.prototype.onRowClick.call(event, rowElement, silent);
};

Solution

  • I forgot to put "this" as first parameter in the prototype method call

    PF('myTableWidget').onRowClick = function (event, rowElement, silent) {
        //do some stuff
        PrimeFaces.widget.DataTable.prototype.onRowClick.call(this,event, rowElement, silent);
    };