Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rondale-sc/pivot.js
base: 2141bee046
...
head fork: rondale-sc/pivot.js
compare: 8b10269f36
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 26 additions and 10 deletions.
  1. +5 −5 index.html
  2. +21 −5 jquery_pivot.js
View
10 index.html
@@ -103,7 +103,7 @@
<ul class="dropdown-menu">
<li><a id="ar-aged-balance" href="#">AR Aged Balance</a></li>
<li><a id="acme-detail-report" href="#">Acme Corp Detail</a></li>
- <li><a id="jacksonville-invoice-detail" href="#">Jacksonville Invoice Detail</a></li>
+ <li><a id="miami-invoice-detail" href="#">Miami Invoice Detail</a></li>
</ul>
</li>
</ul>
@@ -198,15 +198,15 @@
// **Sexy** In your console type pivot.config() to view your current internal structure (the full initialize object). Pass it to setup and you have a canned report.
$('#ar-aged-balance').click(function(event){
- setupPivot({"url":'./lib/csv/demo.csv', "fields": fields, "filters":{},"rowLabels":["employer"],"columnLabels":["age_bucket"],"summaries":["balance"]})
+ $('#pivot-demo').pivot_display('reprocess_display', {rowLabels:["employer"], columnLabels:["age_bucket"], summaries:["balance"]})
});
$('#acme-detail-report').click(function(event){
- setupPivot({"url":'./lib/csv/demo.csv', "fields": fields, "filters":{"employer":"Acme Corp"},"rowLabels":["city","last_name","first_name","state","invoice_date"],"columnLabels":[],"summaries":[]})
+ $('#pivot-demo').pivot_display('reprocess_display', {filters:{"employer":"Acme Corp"},rowLabels:["city","last_name","first_name","state","invoice_date"]})
});
- $('#jacksonville-invoice-detail').click(function(event){
- setupPivot({"url":'./lib/csv/demo.csv', "fields": fields, "filters":{"city":"Jacksonville"},"rowLabels":["last_name","first_name","employer","invoice_date"],"columnLabels":[],"summaries":["payment_amount"]})
+ $('#miami-invoice-detail').click(function(event){
+ $('#pivot-demo').pivot_display('reprocess_display', {"filters":{"city":"Miami"},"rowLabels":["last_name","first_name","employer","invoice_date"],"summaries":["payment_amount"]})
});
});
</script>
View
26 jquery_pivot.js
@@ -28,11 +28,7 @@ var methods = {
if (options.skipBuildContainers === undefined || options.skipBuildContainers === false) self.build_containers();
- self.build_toggle_fields('#row-label-fields', pivot.fields().rowLabelable, 'row-labelable');
- self.build_toggle_fields('#column-label-fields', pivot.fields().columnLabelable, 'column-labelable');
- self.build_toggle_fields('#summary-fields', pivot.fields().summarizable, 'summary');
-
- methods.build_filter_list();
+ self.populate_containers();
$('.row-labelable').change(function(event) {
self.update_label_fields('row');
@@ -75,6 +71,26 @@ var methods = {
}
});
},
+ populate_containers: function(){
+ methods.build_toggle_fields('#row-label-fields', pivot.fields().rowLabelable, 'row-labelable');
+ methods.build_toggle_fields('#column-label-fields', pivot.fields().columnLabelable, 'column-labelable');
+ methods.build_toggle_fields('#summary-fields', pivot.fields().summarizable, 'summary');
+ methods.build_filter_list();
+ },
+ reprocess_display : function(options){
+ if (options.rowLabels === undefined) options.rowLabels = [];
+ if (options.columnLabels === undefined) options.columnLabels = [];
+ if (options.summaries === undefined) options.summaries = [];
+ if (options.filters === undefined) options.filters = {};
+
+ pivot.filters().set(options.filters);
+ pivot.display().summaries().set(options.summaries);
+ pivot.display().rowLabels().set(options.rowLabels);
+ pivot.display().columnLabels().set(options.columnLabels);
+
+ methods.populate_containers();
+ methods.update_results();
+ },
build_containers : function(){
var containers = '<div style="margin-left:-20px;*zoom:1;">' +

No commit comments for this range

Something went wrong with that request. Please try again.