madhur
madhur

Reputation: 1001

Using getFillteredRows in google charts with additional property

I have a row structure like this

c:[
  { v: 'somevalue'},
  { v: 'somevalue'},
  { 
    v: 'somevalue',
    link: 'abc.com'
  }    
]

now I need all the rows which has link property present in 3rd column, is it possible using getFillteredRows function ?

Upvotes: 0

Views: 189

Answers (1)

WhiteHat
WhiteHat

Reputation: 61275

first, to use cell properties correctly, the structure would resemble the following...

c:[
  { v: 'somevalue'},
  { v: 'somevalue'},
  { 
    v: 'somevalue',
    p: {
      link: 'abc.com'
    }
  }    
]

to get or set the properties, use the following methods...

getProperty(rowIndex, columnIndex, name)

setProperty(rowIndex, columnIndex, name, value)

adding in getFilteredRows (spelling - one L in filter)...

use the test function, to find all the rows which has link property present in 3rd column

var rowsFound = data.getFilteredRows([{
  column: 2,
  test: function (value, row, column, table) {
    return (table.getProperty(row, column, 'link') !== null);
  }
}]);

Upvotes: 1

Related Questions