Coder Social home page Coder Social logo

minor bug part 2 about sheetrock HOT 12 CLOSED

chriszarate avatar chriszarate commented on June 10, 2024
minor bug part 2

from sheetrock.

Comments (12)

chriszarate avatar chriszarate commented on June 10, 2024

Sometimes Google Spreadsheets automatically withholds the header row (usually when the user has employed "View > Freeze rows...") and sometimes it doesn't. The trouble is that it doesn't pass any reliable indicator of whether this is the case. It's hard to tell the difference between data and column labels.

I've made an option available (actually I repurposed one that wasn't doing much of anything) to address this issue. By default, Sheetrock will treat the first returned row as the header row. Alternatively, you can tell it to treat the column labels as the header row. Do this using the "header" option:

var myOptions = { url: [...], header: true };
$('#statistics').sheetrock(myOptions);

I've updated the JSFiddle to use this new option.
http://jsfiddle.net/DymcL/1/

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

Well that's what I thought that option did..."do we have a header"

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

You must think I'm a nutjob:)

Anyway now the original spreadsheet (eg the test one) doesn't display header info only column titles like A B C etc

https://docs.google.com/spreadsheet/ccc?key=0Ag1L9aBNT9eNdEJoOF9vQks4SUxKVHlOOUk3VjVVQWc#gid=0

I've made it public for now

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

No, I really appreciate the testing you are doing. I haven't been able to test it on a wide variety of spreadsheets so this is really, really useful. I'll take a look at this soon.

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

I took a look. It's working correctly, you just have to adjust the header option accordingly:

http://jsfiddle.net/DymcL/2/

What I was trying to say above is that Sheetrock is unable to automatically figure out whether Google Spreadsheets has identified a header row. So it's up to you to test and supply a header option if necessary.

Here's what I'd suggest. First try it without the header option (the default is false). If you find that the header row is omitted, supply a header of true. Does that make sense?

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

Here's an updated JSFiddle that might help explain things better:

http://jsfiddle.net/DymcL/3/

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

:)

Ja makes sense (sort of) however I've edited the fiddle to demo what I mean.
So I need to identify if the ss has a header row and as you say turn on/off the header option?

That's a bit annoying but not a major headache...
I'll look into it later myself as I'm busy on other stuff right now:(

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

My view would be if header is on then row 1 wouldl be the header? that would suit me:)

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

OK here's my idea for what it's worth:
The header option tells the module to treat x numbers of lines as the header with zero as the default, so if header : 2 then the first 2 lines are the header lines, if it is zero then the column names (A/B/C etc) are the column titles...

What do you think?

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

That's a good approach and I've implemented it (but we're back to using headers instead of header). The only caveat is that if Google has identified a row as a header row and uses it for the column labels, you can't override it with headers: 0.

I think it works well and is reasonably intuitive. Let me know what you think.

http://jsfiddle.net/DymcL/5/

from sheetrock.

bealtine avatar bealtine commented on June 10, 2024

yeah just tried it out seems to be ok, One table outputs the column names and the other A/B/C etc. I think it's a reasonable compromise myself...now on with what I really want to do:)
Not sure how google identifies a row as a header though...

from sheetrock.

chriszarate avatar chriszarate commented on June 10, 2024

I believe it's triggered by "View > Freeze rows...". At least that's the correlation I've seen.

Thanks for the suggestion.

from sheetrock.

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.