Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit 4d28d71

Browse files
committed
Don't default to pretty columns when using a proxy
1 parent 7b2024a commit 4d28d71

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ You pass in either `key` as the actual spreadsheet key, or just the full publish
120120

121121
`callbackContext` sets the `this` for your callback. It's the tabletop object by default.
122122

123-
`prettyColumnNames` can be true or false (default to true). Since Google doesn't pass us exactly the same column names as in the header ('$ Processed' becomes 'processed'), it takes an extra request to correct them. If you don't want the extra request, you'll want to set it to `false`
123+
`prettyColumnNames` can be true or false (default to true, unless `proxy` is enabled**). Since Google doesn't pass us exactly the same column names as in the header ('$ Processed' becomes 'processed'), it takes an extra request to correct them. If you don't want the extra request, you'll want to set it to `false`
124124

125125
> See the **unfriendly_headers** example for more info. Only works for newer Google Sheets.
126126
127+
> ** prettyColumnNames doesn't work with [Flatware](https://github.com/jsoma/flatware), is why we disable it with a proxy by default
128+
127129
### Tabletop itself
128130

129131
Once you've initialized a `tabletop` object you can access its good parts.

src/tabletop.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@
6969
this.singleton = !!options.singleton;
7070
this.simple_url = !!options.simple_url;
7171
this.callbackContext = options.callbackContext;
72-
this.prettyColumnNames = typeof(options.prettyColumnNames) == 'undefined' ? true : options.prettyColumnNames
72+
// Default to on, unless there's a proxy, in which case it's default off
73+
this.prettyColumnNames = typeof(options.prettyColumnNames) == 'undefined' ? !options.proxy : options.prettyColumnNames
7374

7475
if(typeof(options.proxy) !== 'undefined') {
7576
// Remove trailing slash, it will break the app
@@ -78,7 +79,7 @@
7879
this.singleton = true;
7980
// Let's only use CORS (straight JSON request) when
8081
// fetching straight from Google
81-
supportsCORS = false
82+
supportsCORS = false;
8283
}
8384

8485
this.parameterize = options.parameterize || false;
@@ -469,6 +470,7 @@
469470
fetchPrettyColumns: function() {
470471
if(!this.raw.feed.link[3])
471472
return this.ready();
473+
this.log("Fetching pretty columns");
472474
var cellurl = this.raw.feed.link[3].href.replace('/feeds/list/', '/feeds/cells/').replace('https://spreadsheets.google.com', '');
473475
var that = this;
474476
this.tabletop.requestData(cellurl, function(data) {

0 commit comments

Comments
 (0)