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

Commit

Permalink
Don't default to pretty columns when using a proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoma committed May 26, 2015
1 parent 7b2024a commit 4d28d71
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ You pass in either `key` as the actual spreadsheet key, or just the full publish

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

`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`
`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`

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

Once you've initialized a `tabletop` object you can access its good parts.
Expand Down
6 changes: 4 additions & 2 deletions src/tabletop.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
this.singleton = !!options.singleton;
this.simple_url = !!options.simple_url;
this.callbackContext = options.callbackContext;
this.prettyColumnNames = typeof(options.prettyColumnNames) == 'undefined' ? true : options.prettyColumnNames
// Default to on, unless there's a proxy, in which case it's default off
this.prettyColumnNames = typeof(options.prettyColumnNames) == 'undefined' ? !options.proxy : options.prettyColumnNames

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

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

0 comments on commit 4d28d71

Please sign in to comment.