Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: Dynamic number of columns of table component

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    13

    Default Dynamic number of columns of table component

    Hello, after getting to a dynamic query with spoon I have encountered the following problem in CDE.

    The query I do not have a fixed number of columns. When first execution the table component draws well, and if I run the query with a result with the same number of columns as well do it right, but if, according to a filter that I have, the number of columns is different I get the following error "DataTables warning (table id = 'datosTable'): Added data (size 5) does not match known number of columns (4)".

    I need help urgently please have someone help me.
    Some form of redrawing the table component, or remove it and repaint it, somehow ...

  2. #2
    Join Date
    Mar 2011
    Posts
    257

    Default

    You will have to use the post fetch function to check the amount of columns the datasource pulls.
    not really sure what you have to change to the table to make it stop complaining (i'm guessing chartDefinition will be enough)

  3. #3
    Join Date
    Dec 2010
    Posts
    304

    Default

    Hi,
    I'm going to use an example to show you the solution I use in this cases... probably it's not the best solution but it's work...
    If my query returns from 5 to 10 columns, I set 10 fixed columns in my dataTable.
    When the number of columns returned by the query is less than 10, I hide (using css properties) the table columns I don't need.
    I do that in the draw function.

  4. #4
    Join Date
    Jun 2012
    Posts
    13

    Default

    I see the number of columns of resultset with this.queryState.lastResults().resultset, and the number of current columns of the table component with this.chartDefinition.colHeaders.length, but i cant change the number of columns. In chartDefinition i cant see a properti for do that.

    Any idea?

  5. #5
    Join Date
    Jun 2012
    Posts
    13

    Default

    Sorry, your solution may be valid, but i dont like me. I will consider it if i havent other choose. But what i want is something more easy.
    I have other chart, a line chart, this chart is redraw when the listener active it, and the new columns are added without problems. My question is why in table component dont happens that. What i want is if there is a function to redraw or reset the table component in preexecution or in pre change, for what each execution will be as the first

    (sorry for my english xD)
    Last edited by beldario; 08-07-2012 at 07:24 AM.

  6. #6
    Join Date
    Jun 2012
    Posts
    13

    Default

    Im trying with something like Dashboards.components[i].clear(), Dashboards.update(components[i]), Dashboards.init(component), Dashboards.initEngine(component), Dashboards.RefreshEngine()...
    but nothing works...
    Someone can help me?
    Last edited by beldario; 08-08-2012 at 07:14 AM.

  7. #7
    Join Date
    Jul 2010
    Posts
    4

    Default

    hey. try this function in the 'pre execution' of the table component. it worked for me;


    function() {
    this.chartDefinition.colHeaders = [];
    this.chartDefinition.colTypes = [];
    this.chartDefinition.colFormats = [];
    }


    S

  8. #8

    Default

    it's work me too!

    thanks

  9. #9
    Join Date
    Mar 2013
    Posts
    8

    Default

    Great solution for dynamic column header problem


    Quote Originally Posted by nevets525 View Post
    hey. try this function in the 'pre execution' of the table component. it worked for me;


    function() {
    this.chartDefinition.colHeaders = [];
    this.chartDefinition.colTypes = [];
    this.chartDefinition.colFormats = [];
    }


    S
    With thanks
    M. Nessa

  10. #10
    Join Date
    Aug 2013
    Posts
    25

    Default

    Great solution, however with no data, it returns an "Error processing component", caused by this.chartDefinition.colHeaders=[]. So I think a check if data is available should be added, but how to perform?

    Groets,

    Jaap-Andre

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.