javascript - Override a method from a Primefaces specific widget -


i want overwrite function of primefaces datatable component. according question: how find and/or override javascript in primefaces component based on widgetvar? possible using primefaces.widget.datatable.prototype.. want override function 1 datatable only, not all.

this not work:

<p:datatable widgetvar="mytable" ...> </p:datatable> .... <script type="text/javascript">        $(document).ready(function(){            if (pf('mytable') !== undefined) {                 pf('mytable').jq.datatable({                      showcelleditor: function (c) {                          console.log('my function');                      }                  });             }          }); </script> 

is how supposed done or wrong?

tested 1 of tables:

pf('mytable').showcelleditor = function() {     console.log('my function') } 

don't forget call generic implementation if need to:

pf('mytable').showcelleditor = function() {     console.log('my function')     // call generic implementation:     primefaces.widget.datatable.prototype.showcelleditor.call(this); } 

see also:


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -