Well, I was able to finally get it working. Seems like removing the initial 
sortColumn worked, but now I am stuck on a whole new issue that is quite 
interesting....

I have 2 events bound to the table, sort and select, because I need to 
disable sort on 2 columns, and I need to enable multi row select. The 
problem... Apparently if you bind a select event, the sort event never gets 
called. Instead, when I click on a table header to invoke tableSort, it 
runs tableSelect. So the select event supersedes the sort event and sort 
will never get called. Any ideas?

On Friday, January 22, 2016 at 11:24:20 AM UTC-8, Daniel LaLiberte wrote:
>
> 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 [email protected] 
>> <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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
>>  
>> <https://groups.google.com/d/msgid/google-visualization-api/f6d1fcdd-a669-4f2f-8ca4-fbae08999480%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
> [email protected] <javascript:>   5CC, Cambridge MA
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to