From: Mike Taylor Date: Tue, 7 Oct 2014 10:49:33 +0000 (+0100) Subject: Creation of the pz2 object is now done in the makePz2 function, which X-Git-Tag: 1.0.0~298 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=ef24216dc703f3887c7d6207eff8a16f5c53dd29 Creation of the pz2 object is now done in the makePz2 function, which is now invoked only at the very end of the constructor. --- diff --git a/src/mkws-team.js b/src/mkws-team.js index 0a556eb..185b1c3 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -91,23 +91,25 @@ mkws.makeTeam = function($, teamName) { m_sortOrder = config.sort_default; m_perpage = config.perpage_default; - - // create a parameters array and pass it to the pz2's constructor + + // create a parameters array and pass it to the pz2's constructor // then register the form submit event with the pz2.search function // autoInit is set to true on default - m_paz = new pz2({ "windowid": teamName, - "pazpar2path": mkws.pazpar2_url(), - "usesessions" : config.use_service_proxy ? false : true, - "oninit": onInit, - "onbytarget": onBytarget, - "onstat": onStat, - "onterm": (config.facets.length ? onTerm : undefined), - "onshow": onShow, - "onrecord": onRecord, - "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way - "termlist": config.facets.join(',') - }); - log("created main pz2 object"); + that.makePz2 = function() { + m_paz = new pz2({ "windowid": teamName, + "pazpar2path": mkws.pazpar2_url(), + "usesessions" : config.use_service_proxy ? false : true, + "oninit": onInit, + "onbytarget": onBytarget, + "onstat": onStat, + "onterm": (config.facets.length ? onTerm : undefined), + "onshow": onShow, + "onrecord": onRecord, + "showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way + "termlist": config.facets.join(',') + }); + log("created main pz2 object"); + } // pz2.js event handlers: function onInit() { @@ -463,5 +465,6 @@ mkws.makeTeam = function($, teamName) { } + that.makePz2(); return that; };