简体   繁体   中英

How do I add a fixed row to bottom of a Google visualization table

I currently am creating a table with Google visualization that has a bunch of data with a totals row along the bottom. I am getting an array of data using ajax from a PHP file which looks something like this,

myarray = array(
    0 => array(
        'cols' => array(0 => array('v' => 'data', 'p' => 'data')),
        'rows' => array(0 => array('v' => 'data', 'p' => 'data'))
    )
);

When the header columns are clicked on the data sorts which is cool, but the totals row is also sorting which is not cool. I have looked all over the web trying to find the best solution to this but I have not yet.

Unfortunately, there's no direct way to do this provided by the api. In the past I've gotten around this by just generating a second 'summary' table, (gviz, or maybe something else if you'd like it to stand out a bit) which holds relevant totals, and never changes.

Alternatively, you code presort the table by the most relevant column, then disallow sorting on the table in the UI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM