Cancel selection or determine previous one?

7 posts, 0 answers
  1. Ryan
    Ryan avatar
    12 posts
    Member since:
    Oct 2012

    Posted 27 Mar 2014 Link to this post

    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?  
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 28 Mar 2014 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Ryan
    Ryan avatar
    12 posts
    Member since:
    Oct 2012

    Posted 28 Mar 2014 in reply to Kiril Nikolov Link to this post

    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...
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 31 Mar 2014 Link to this post

    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!
     
  6. Ryan
    Ryan avatar
    12 posts
    Member since:
    Oct 2012

    Posted 02 Apr 2014 in reply to Kiril Nikolov Link to this post

    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.
  7. Ryan
    Ryan avatar
    12 posts
    Member since:
    Oct 2012

    Posted 02 Apr 2014 in reply to Ryan Link to this post

    Sorry, the link above should be http://jsbin.com/qimaf/3/edit

  8. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2566 posts

    Posted 04 Apr 2014 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready