So I get a dump from our internal LDAP which has more columns then I
need and then I build the formatted columns I need on top of that.
Here's the raw code with some comments:
Assume column 0-10 are already used. The tool_tip_formatter corrects
for the fact that I get first name and last name as separate columns,
the formatter "permanently" creates a formatted value for the tool tip
with both concatenated. The following three create two extra columns
that I can swap into the View based on the user selection in a select
box. First I add the column, then I use the for loop to iterate
through the rows to initialize the date with the base information from
the first column which I use as the default value. The subsequent
formatters create separate formatted data values for each column.
Link creates a direct link on the name to our internal lookup, the
second one reformats to embed a link to their picture in our internal
system. Then in practice, I swap which columns are in the Data View
based on user selection. The default shown provides the user initials
with hyperlink to the employee lookup. Let me know if that helps.
var tool_tip_formatter = new google.visualization.PatternFormat( '{0}
{1}');
tool_tip_formatter.format(data,[1,2],2);
data.addColumn("string","withDept","wDept");
data.addColumn("string","withTitle","wTitle");
for(i=0;i<data.getNumberOfRows();i++) {
data.setValue(i,11,data.getValue(i,0));
data.setValue(i,12,data.getValue(i,0));
}
var link_formatter = new google.visualization.PatternFormat( '<a
href="http://emplookup.XXX.com/emplookup/view_emp.jsf?lookup={0}"
target="_blank">{0}</a>');
link_formatter.format(data,[0],11);
var dept_formatter = new google.visualization.PatternFormat( '{0}<br/
>{1}');
dept_formatter.format(data,[0,9],12);
var title_formatter = new google.visualization.PatternFormat( '<img
src="http://emplookup.XXX.com/emplookup/MugshotDownload?userId={0}"/
><br/>{2} ({0})<br/>{1}');
title_formatter.format(data,[0,8,2],13);
view = new google.visualization.DataView(data);
view.setColumns([11,6,2]);
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.