javascript - Bootstrap popover doesn't work in object -
javascript - Bootstrap popover doesn't work in object -
i trying create own js class table grid adjustments(hide columns) , popover button doesn't work.
when utilize of functions on page works, when set in prototype fails.
here grid.js:
function grid(element, tableid, module){      homecoming this.init(element, tableid, module); };  grid.prototype = {      grid: [],      element: "",      popover: null,      tableid: "",      module: "",      backendurl: location.href,      formid: "#grid_form",      wrapper: "#grid_entities",      init: function(element, tableid, module){              this.element = element;             this.tableid = tableid;             this.module = module;              this.initbutton();             this.addonclicklistner();       },      initbutton: function(){          this.popover = $(this.element).popover({             placement: "bottom",             html: true,             content: this.getpopovercontent()         });      }, ...    index.php:
<div id="filterbuttons">     <i class="left iconfilter" id="filterbutton" data-toggle="popover"></i>     <i class="left iconlayout" id="gridbutton" data-toggle="popover"></i> </div> ... <script> $(document).ready(function () {     var grid = new grid(...); }); </script>    also grid.js included in bottom of page.
i don't see addonclicklistener suspect it's problem this. constructor function should not  homecoming anything. can this:
function grid(element, tableid, module){     this.init(element, tableid, module); };  grid.prototype = {     //...     constructor:grid,     addonclicklistner:function(){         var me = this;          homecoming function(e){             //e event, e.target clicked element             //me grid instance             console.log("button clicked, e is:",e," , is:"               ,this," , me is:",me);             me.whateveryouhaveinonclicklistener();         }     }    errors helpful, in chrome or firefox (with firebug plugin installed) press f12 , see if there errors in console. console.log see values of variables are.
more on prototype, constructor functions , value of this can found here.
 javascript jquery popover 
 
Comments
Post a Comment