var chart = new google.visualization.Table(document.getElementById('myTable'));
google.visualization.events.addListener(chart, 'sort', function(e) { handleSort(e, chart); });
chart.draw(opts, dataTable);
function handleSort(e, chart) {
if(e.column == 9) {
console.log('inside sort function');
return false;
}
}function handleSort(e, chart) {
if(e.column == 9) {
chart.options['sortColumn'] = 0;
chart.options['isAscending'] = true;
}
}--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f6d1fcdd-a669-4f2f-8ca4-fbae08999480%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Robert,Setting the 'sort' option to 'event' is necessary, and it should be sufficient to prevent the internal sorting. But if you are also specifying the initial sortColumn, there might be some interference since it will be used each time the chart is redrawn with chart.draw(). It shouldn't be used for any of the internal redraws that occur, but it is possible you have found a bug. Try not setting the initial sortColumn to see how that works.If you can point me at your page, I would be happy to look into what I see it doing.
On Fri, Jan 22, 2016 at 1:59 PM, Robert Mason wrote:
I am having a bit of an issue, If I add event functions for select and sort on my table the default Google functions run anyway. It's kind of hard to explain, but here is a very simple example...var chart = new google.visualization.Table(document.getElementById('myTable'));
google.visualization.events.addListener(chart, 'sort', function(e) { handleSort(e, chart); });
chart.draw(opts, dataTable);
function handleSort(e, chart) {
if(e.column == 9) {
console.log('inside sort function');
return false;
}
}With that code above, when I click on the header for column 9 I get the console log of 'inside sort function', but then the table sorts itself on that column. I have even tried doing this...function handleSort(e, chart) {
if(e.column == 9) {
chart.options['sortColumn'] = 0;
chart.options['isAscending'] = true;
}
}When that runs, it still sorts the table by column 9. No matter what I do I can't get the table to stop sorting. I did set 'sort' to 'event' in the opts object that gets passed in to the draw method.Please, I am pretty desperate for ideas or answers. I need to make the table stop sorting when column 9 is clicked on. The reason... there is a button in the header for column 9, when the user clicks that button it is supposed to do an action, which is does, but it sorts the table which ruins everything. Thank you in advance for any help, I appreciate all input.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f6d1fcdd-a669-4f2f-8ca4-fbae08999480%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/f6d1fcdd-a669-4f2f-8ca4-fbae08999480%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/c394a0a2-9b9c-4f1e-af67-0cc415d66b1e%40googlegroups.com.