This is a migrated thread and some comments may be shown as answers.

How to detect active sheet has changed

2 Answers 192 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Sandra Walters
Top achievements
Rank 1
Sandra Walters asked on 06 May 2016, 03:10 PM

Hello all,

I'm looking for a way to detect that the user has selected a different sheet (tab) within the spreadsheet control.  There doesn't seem to be an event for this action.  Is there some other way to detect that the active sheet has been changed?

As background - I'm working on an app for a client in which I've added the spreadsheet control, with several sheets.  There's no facility for a custom cell editor (such as a dropdown), but the client is adamant that they want one - they do not want their users typing directly in the cell, but rather, making a selection.  I thought a workaround might be to place a dropdown elsewhere on the page, then when the user makes a selection in it, apply the selected text to the currently selected cell on the active sheet.  However, I want to hide the dropdown unless the user is on the sheet to which the dropdown actually applies.  (I'm also open to any suggestions for a different workaround that doesn't require the user to type out the text themselves.) 

2 Answers, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 10 May 2016, 07:37 AM

Hello Sandra,

At this time, there is not event triggered when the sheet is changed. You can submit this as a feature request on UserVoice, so that it is considered for implementation in a future release. As a workaround, you can bind to the spreadsheet render event and check if the activeSheet is the one you need to show the drop-down for.

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
David M
Top achievements
Rank 1
answered on 18 May 2016, 08:20 PM
I've been looking into doing this same thing on specific cells, and the only thing I can think of currently is capturing the click using the "render" callback for the entire spreadsheet.  This function is called on almost everything because each click renders something, and if you add this with the "sheet.selection" method you can then dictate whether or not the "dropdown" cell has been selected, and therefore making the selection ui appear.  Then it's just up to using the range.value to edit the sheets data.  
Tags
Spreadsheet
Asked by
Sandra Walters
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
David M
Top achievements
Rank 1
Share this question
or