How to find and / or override JavaScript in a widgetsVar based Primefaces component?

According to this question: Multiple file downloads with optional inputText I can override the JavaScript function of the PrimeFaces element using widgetVar as follows:

PF('fileUpload').jq.fileupload({
    add: function(e, data) {
           ...
         }
    });

Now I'm trying to override a function in a DataTable and can't figure out how I can refer to it? Moreover, PF (') returns undefined from the chrome debugger console, so I cannot debug it. I suspect this is a matter of areas, but I don’t know how to solve it.

+4
source share
2 answers

, , bindEditEvents :

PrimeFaces.widget.DataTable.prototype.bindEditEvents = function() {
  ....
}
+10

. , .

DataScroller.

, , , :

№ 1 ( )

PrimeFaces.widget.DataScroller = PrimeFaces.widget.BaseWidget.extend({
    init: function(cfg) {
        this._super(cfg);

        // only for widget with widgetVar="yourWidgetVar"
        if(cfg.widgetVar === 'yourWidgetVar') {
            this.yourCustomMethod();
        }
    },

    yourCustomMethod: function() {
        // do whatever you prefer here
    }
});

№ 2 ( )

PF('yourWidgetVar').init = function() {

    // do whatever you prefer here

    // call the generic implementation
    PrimeFaces.widget.DataScroller.prototype.init.call(this);
};
+1

Source: https://habr.com/ru/post/1568184/


All Articles