简体   繁体   中英

JavaScript functions are not interpreted when using PivotTable.js

I have integrated PivotTable.js on my web application. The pivot table is shown normally but in some first columns and rows, functions are written and it is not interpreted (See the screenshot) This is an example of a function written:

function each(iterator, context) { 
   var index = 0; 
   try { 
       this._each(function(value) { 
           iterator.call(context, value, index++);
        });
   } catch (e) {
      if (e != $break) throw e;
   }
 return this;
 }

These are screenshots taken from the result:

pivot_table

Pivot table2

This is my code:

<script type="text/javascript" src="./jquery-1.11.0.min.js"></script>

<script type="text/javascript" src="./jquery-ui.min.js"></script>
<script type="text/javascript" src="./jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="./pivot.min.js"></script>
<script type="text/javascript" src="./tips_data.min.js"></script>

<link rel="stylesheet" href="./pivot.min.css">


<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($) {
  $("#output").pivotUI(
    $.pivotUtilities.tipsData, {
      rows: ["sex", "smoker"],
      cols: ["day", "time"],
      vals: ["tip", "total_bill"],
      aggregatorName: "Sum over Sum",
      rendererName: "Heatmap"
    });
});

</script>

<div id="output"></div>

THe issue is referenced officially here: https://github.com/nicolaskruchten/pivottable/issues/708

As i understand, no out-of-the-box solution yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM