Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9247503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:44:40+00:00 2026-06-18T09:44:40+00:00

I have the following code: //creates a DataTable. don’t worry about this. this works

  • 0

I have the following code:

 //creates a DataTable. don't worry about this. this works
var projectData = createDataView(json);

// Create and draw the visualization.
var table = new google.visualization.ChartWrapper({
    chartType: "Table",
    containerId: "projectChart"
});

// add user filter
var userFilter = new google.visualization.ControlWrapper({
    'controlType': 'StringFilter',
    'containerId': 'userFilter',
    'options': {
        'filterColumnLabel': 'User'
    }
});

var dashboard = new google.visualization.Dashboard(
            document.getElementById('projectChartContainer'))
        .bind(userFilter, table);

function drawTable() 
{
    dashboard.draw(projectData, {
        'allowHtml': true,
        showRowNumber: true,
        title: "Project Data",
        width: middleWidth
    });


    // google visualization styles
    $(".google-visualization-table-td-number").addClass("small");
    $(".google-visualization-table-td-center").addClass("eighty");
}

// set width 
middleWidth = $("#contentMiddle").width();
drawTable();

// if user resized the browser, change the width and redraw.  
//this is ugly, but the only way i could find. 100% was buggy
$(window).resize( function() {
    middleWidth = $(window).width()-142;
    drawTable();
});

// add a change listener to table
google.visualization.events.addListener(table, 'ready', function() {                    
    // get hour totals
    var workedHours = 0;
    var billedHours = 0;

    // THIS IS WHERE I NEED HELP!!!!!       
    /*var dataLength = table.getNumberOfRows();
    for (var x = 0; x < dataLength; x++)
    {
        workedHours += table.getValue(x, 7);
        billedHours += table.getValue(x, 9);
    }
    $("#totalWorked").text(workedHours);
    $("#totalBilled").text(billedHours);
    $("#totalsContainer").show();*/

    console.log(projectData.getValue(1,1));
});

Everything works fine as far as the table displaying and filtering. What I need is a way to grab the newly filtered table’s column totals. I can use projectData.getValue() to get the values the first time, but it returns the same values no matter what is filtered out. I could have no rows in the newly drawn table and it will show the same values as it did originally. I’m not really surprised because I’m really just changing the table and listening for it to be redrawn. But I cannot get any values from the table. The functions I have above for table (ie…table.getNumberOfRows()) do not exist. That’s just what I would like to happen. Any ideas of how to get the new column values of a filtered table?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:44:42+00:00Added an answer on June 18, 2026 at 9:44 am

    My suggestion is to turn the table data in to a datatable first with var tableData = table.getDataTable();

    That dataTable will be filtered and ordered as shown in your table. You can then run your for() loop on tableData:

    for (var x = 0; x < tableData.getNumberOfRows(); x++)
    {
        workedHours += tableData.getValue(x, 7);
        billedHours += tableData.getValue(x, 9);
    }
    $("#totalWorked").text(workedHours);
    $("#totalBilled").text(billedHours);
    $("#totalsContainer").show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which creates a new table. var html = '<table>';
I have a datatable AVT of type AvailDataTable. The following code works to create
I have the following code which creates a simple window with two buttons which
I have the following code that creates a serverside object of the xmlhttp class.
I have the following code which creates an ImageButton and plays a sound when
I have the following code that creates the meta-description. I'm getting a 0 as
I have the following code that creates a submenu based on current document. The
I have a method that contains the following (Java) code: doSomeThings(); doSomeOtherThings(); doSomeThings() creates
I have the following C# code that creates a DateTime , enters it into
Suppose I have the following code snippets, i.e. goo call foo, DataTable created by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.