在带有附加属性的Google图表中使用getFillteredRows [英] Using getFillteredRows in google charts with additional property

查看:127
本文介绍了在带有附加属性的Google图表中使用getFillteredRows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的行结构

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

现在我需要链接属性存在于第3列的所有行,是否可以使用getFillteredRows函数?

解决方案

首先,要正确使用 cell 属性,结构将类似于以下内容...

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

get set 属性,请使用以下方法 ...



getProperty(rowIndex,columnIndex,na我)



setProperty(rowIndex,columnIndex,name,value)



getFilteredRows (拼写 - 一个L在过滤器中)...

使用 test code>函数来查找第三列中存在link属性的所有行

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


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 ?

解决方案

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);
  }
}]);

这篇关于在带有附加属性的Google图表中使用getFillteredRows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆