Hi,
I am trying to modify org chart by JQuery.
data.setCell(0, 0, '0', '<div class="droparea"> </div>');
This div works outside the javascript however it is not functioning in
any cell of chart.
<script type="text/javascript">
var data = new google.visualization.DataTable();
var orgchart;
var i = 0;
var j = 0;
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
data.addRow();
data.setCell(0, 0, '0', '<div class="droparea"> </div>');
data.setCell(0, 1, '0');
for (i = 0; i < 3; i++) {
for (j = 1; j <= 3; j++) {
data.addRow();
data.setCell(i * 3 + j, 0, (i * 3 + j).toString(), (i *
3 + j).toString() + '');
data.setCell(i * 3 + j, 1, i.toString());
data.setCell(i * 3 + j, 2, i.toString());
}
}
function drawVisualization() {
// Create and populate the data table.
orgchart = new google.visualization.OrgChart
(document.getElementById('visualization'));
orgchart.draw(data, { allowHtml: true, allowCollapse:
true });
google.visualization.events.addListener(orgchart, 'select',
selectHandler);
}
google.setOnLoadCallback(drawVisualization);
// The selection handler.
// Loop through all items in the selection and concatenate
// a single message from all of them.
function selectHandler(e) {
var selection = orgchart.getSelection();
var message = '';
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.row != null) {
var val = data.getFormattedValue(item.row, 0);
var str = data.getValue(item.row, 0) + val;
message += '{row:' + item.row +val+
'}';
}
}
if (message == '') {
message = 'nothing';
}
//alert('You selected ' + message);
}
function add() {
var selection = orgchart.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.row != null) {
var total=data.getNumberOfRows();
data.addRow();
data.setCell(total, 0, (total).toString(), 'NEW');
data.setCell(total, 1, item.row.toString());
drawVisualization();
}
}
}
function deleteitem() {
var selection = orgchart.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.row != null) {
data.removeRow(item.row);
drawVisualization();
}
}
}
</script>
--
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.