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

Cancel selection or determine previous one?

6 Answers 112 Views
ButtonGroup
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 27 Mar 2014, 10:51 PM
I have a button group for a mobile app and i have to use "up" for selectOn because it is on a scrolling page.

I need to make it so that when the user taps a particular button (say button4) in the group, a confirmation dialog appears asking them if they are sure they wanted to do that.  

So say the user currently has button2 selected.  They tap button3, the confirmation dialog appears, and they hit cancel.  How can i make it so button2 stays selected if they hit cancel?  

6 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 28 Mar 2014, 10:49 AM
Hello Ryan,

You can use the select() method of the ButtonGroup widget, so you can select again the Button2. You can read more about this method and see a runnable example here:

http://docs.telerik.com/kendo-ui/api/mobile/buttongroup#methods-select

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ryan
Top achievements
Rank 1
answered on 28 Mar 2014, 07:39 PM
The problem with that is that I have no idea if button2 was the one selected or not.  It could have been button1 or button4 or no button at all.  So selecting Button2 if the user cancels wouldnt make sense...
0
Kiril Nikolov
Telerik team
answered on 31 Mar 2014, 10:17 AM
Hi Ryan,

You can get the currently selected button using the current method():

http://docs.telerik.com/kendo-ui/api/mobile/buttongroup#methods-current

However I am not really sure that I understand exactly what your scenario is and what exactly you are trying to achieve. Can you please create a quick sample in a jsBin (you can use this one as a reference -http://jsbin.com/katocoqu/1/edit ) so we can better understand the problem?

Thank you in advance for your cooperation.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ryan
Top achievements
Rank 1
answered on 02 Apr 2014, 04:35 PM
Go to http://jsbin.com/qimaf/2/edit

Click on any of the following: Option0, Option1, or Option3.  Then click on Option4, and when the dialog comes up choose Cancel.  

After choosing Cancel, there is no way to have it go back to the correct button.  I have it doing a select() on Option2, but that isn't correct if in the above you first clicked Option0, Option1, or Option3.
0
Ryan
Top achievements
Rank 1
answered on 02 Apr 2014, 05:12 PM
Sorry, the link above should be http://jsbin.com/qimaf/3/edit

0
Kiril Nikolov
Telerik team
answered on 04 Apr 2014, 07:56 AM
Hello Ryan,

The problem comes from the fact that when the select events it fired this.current().select() index holds the elements that invoked the selection - in your case the last elements. In order to achieve the functionality that you are looking for you need to persists the previous selection of the widget. I have created a small example, showing a possible implementation here:

http://jsbin.com/sezukoso/1/edit

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ButtonGroup
Asked by
Ryan
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or