Giter Club home page Giter Club logo

Comments (3)

RCura avatar RCura commented on June 24, 2024

Hi,

Actually, as an user, I consider this as a feature, that I do use a lot :
A DataTable column label can be changed (with DT.setColumnLabel(columnIndex, label), while an ID can't.
So, when using big tables, it's really a plus to be able to change the label, to represent different things dynamically, instead of creating a whole new table with different IDs.

So, for my part, I'm using unspecific column ids when creating my tables, and then, I set the labels according to what I want to show. And I really like the way CHAP is using Labels and not IDs 😉

from chap-links-library.

Crashthatch avatar Crashthatch commented on June 24, 2024

Fair enough, but it's quite unintuitive (took me ~30 mins to figure out) when the following works for Start, End and Content, but not Group:

$data['cols'] = array( array( 'id' => "start", "type" => "datetime" ), array( 'id' => "end", "type" => "datetime" ), array( 'id' => "content", "type" => "string" ), array( 'id' => "group", ['label' => 'group' IS REQUIRED HERE FOR THIS COLUMN NOT TO BE IGNORED], "type" => "string" ) ); ... var data = new google.visualization.DataTable( <?php echo json_encode( $data ); ?> );

I'd suggest either changing the other columns to work the same way (use label, rather than ID), or fall back to id if label is not specified.

It should at least be mentioned in the documentation.

from chap-links-library.

josdejong avatar josdejong commented on June 24, 2024

Thanks Crashthatch, good point. Originally the columns where hard coded (start=0, end=1, content=2, optional group=3), but that changed recently by introducing a second optional column, className.

I have made the usage of columns more flexible now:

  • First the timeline tries to read the column ids.
  • if not available, it will read the column labels.
  • if both id's and column's are undefined, it will use the default columning: start=0, end=1, content=2

I see you generate your DataTable from php. Note that unless you use some specific functionality offered by Google DataTable (client side querying, sorting, filtering), or read your data from a Google SpreadSheet, it may be faster and easier use plain JSON instead of Google DataTable.

from chap-links-library.

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.