Bjarni,

I am surprised to hear that keyboard events are not propagated out of the
table chart elements.  I'd like to find a resolution that at least allows
you to proceed as you have tried.  If you have energy to investigate
further, it may be useful to know that the table chart uses the Google
Closure EventHandler, which is documented at
http://docs.closure-library.googlecode.com/git/class_goog_events_EventHandler.html

As an experiment, you might try adding your own html to a column of the
table, just to see if you can focus on those elements.  Be aware that each
time you call the table.draw() method, it will reuse the previously
generated table element and header row, but replace the body.


On Wed, Mar 25, 2015 at 11:29 AM, Bjarni Gudmundsson <[email protected]>
wrote:

> Thanks for your reply, Daniel.
> I've learned something, but didn't get me all the way.  I can put a
> handler on the containing div of the table and I get mouse click event that
> way, but the keydowns don't turn up. Like the table's scrollbar is
> consuming it...
>
> If I put the handler on the whole document, I get the keydown events -
> always. But when I try use document.activeElement to find the one with the
> focus it returns rational result for all other elements on my page - other
> than the goggle table.  If my table has the focus, activeElement just
> returns the body element like if nothing had the focus :-\
>
> So I guess I have use some other approach for this.
>
> Thanks again,
> Bjarni
>
>
> On Fri, Mar 20, 2015 at 7:07 PM, 'Daniel LaLiberte' via Google
> Visualization API <[email protected]> wrote:
>
>> Hi Bjarni,
>>
>> The table chart doesn't support keyboard events currently, but you could
>> attach event handlers to the html elements yourself, and in your handler
>> call table.setSelection().  You should probably attach your handler to the
>> container element that you give to the table chart constructor, rather than
>> to any deeper html that is generated by the table chart.
>>
>> To find out if a table element has the focus, in your document keydown
>> handler, here is an appropriate stackoverflow page about that:
>> http://stackoverflow.com/questions/497094/how-do-i-find-out-which-dom-element-has-the-focus
>> Given the active element, you can crawl up the dom tree to find out if
>> your table container is one of the ancestors.
>>
>> Hope that helps.
>>
>> It would be nice if we had some built-in support for keyboard events in
>> the table chart.  Feel free to make a feature request about that:
>> https://code.google.com/p/google-visualization-api-issues/issues/list
>>
>> On Fri, Mar 20, 2015 at 1:30 PM, Bjarni <[email protected]> wrote:
>>
>>> Hi, I've had problem figuring out if and how I can implement this.   To
>>> select the next or previous row in a table using the arrow keys.
>>> Is there a way to capture the keydown event when the focus is on the
>>> table - or  during a document keydown capture detect if my table has the
>>> focus so I can react accordingly ?
>>>
>>> Anyone ?
>>>
>>>
>>>  --
>>> 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
>>> http://groups.google.com/group/google-visualization-api.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>>  - 978-394-1058
>> [email protected] <[email protected]>   5CC, Cambridge MA
>> [email protected] <[email protected]> 9 Juniper Ridge
>> Road, Acton MA
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Google Visualization API" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/google-visualization-api/8X9d-W5aeng/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to
>> [email protected].
>> Visit this group at
>> http://groups.google.com/group/google-visualization-api.
>> 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 [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton 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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to