Coder Social home page Coder Social logo

Comments (1)

fooqri avatar fooqri commented on May 19, 2024

I am seeing a similar issue. Changing gid works fine in unpublished worksheets but not in published spreadsheets. The problem can be fixed by modifying three functions in google-sheets.html

First the conditional in the gidChanged() function changes to check for worksheetId OR key so that getCellRows will actually be called in the case of a published spreadsheet.

 gidChanged: function() {
      if (this.worksheetId_ || this.key) {
        this.getCellRows();
      }
    }

and then modifying the way url is set in getCellRows() function

getCellRows: function() {
      // Use cached data if available.
      var key = generateCacheKey_.bind(this)();
      if (key in rowDataCache_) {
        this.onCellRows(null, null, rowDataCache_[key]);
        return;
      }
      var url = "";
      if (this.worksheetId_){
        url = SCOPE_ + '/list/' +
          this.worksheetId_ + '/' + gid_to_wid_(this.gid) +
          '/private/full';
        this.$.cellrowsajax.url = url;
      }
      else if (this.key){
        url = SCOPE_ + '/list/' + this.key + '/' +
                  gid_to_wid_(this.gid) + '/public/values';
        this.$.cellrowsajax.url = url;
      }   
    },

finally to enable the basic caching to work with published spreadsheets modify the generateCacheKey_() function to use either the worksheetId (unpublished spreadsheets) or the key (published spreadsheets)

function generateCacheKey_() {
    var sheetId = this.worksheetId_ || this.key;
    return sheetId + '_'+ this.gid;
  }

Happy to do a pull request if this fix is in line with authors thinking. I am working on this in a non traditional fashion (no bower, no server side environment) so I don't have polymer cloned at the moment.

from google-sheets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.