COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: PlanningDev on 23 Sep 2014 10:04:28 PM

Title: jQuery and jquery plugin issues help!
Post by: PlanningDev on 23 Sep 2014 10:04:28 PM
Im trying to implement jquery with the Fancy Box modal window plugin.  The plugin works fine until the report is reprompted.  Once reprompted its like the plugin and css aren't reloaded and I get an error stating that 

jQuery(...).fancybox is not a function.

I have tried the no conflict and referenced my code using jquery instead of $.  For whatever reason if I reprompt the report it drops the plugin and css links.

Is there anyway to make sure it retains the plugin on reprompt?
   

<script type="text/javascript">

               <link rel="stylesheet" type="text/css" href="../source/jquery.fancybox.css?v=2.1.5"/>
<script type="text/javascript" src="../fancyapps/lib/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="../fancyapps/source/jquery.fancybox.pack.js?v=2.1.5"></script>


jQuery.noConflict();

jQuery(document).ready(function() {

jQuery(".fancybox-iframe").fancybox({

//afterClose: function() {
//var oCR = cognos.Report.getReport("_THIS_");
//oCR.sendRequest(cognos.Report.Action.FINISH);
//},

autoScale : false,
autoCenter: true,
type: 'iframe',
height: 600,
width: 1200,
fitToView : false,
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',

helpers   : {
overlay : {closeClick: false} // prevents closing when clicking OUTSIDE fancybox
  }


});

});
</script>
Title: Re: jQuery and jquery plugin issues help!
Post by: PlanningDev on 24 Sep 2014 10:18:07 AM
Turns out that instead of linking to the fancybox js file I just copied the contents of it into an html item in the report and now it works.  Cognos must do something weird with linked JS files.
Title: Re: jQuery and jquery plugin issues help!
Post by: hardstep on 25 Sep 2014 03:25:44 AM
I would be very interested in hearing about how people use jquery with cognos - the integration of js and how cognos RS overrides content has always been a dark art !!!
Cheers
Nick