Abort view change

6 posts, 0 answers
  1. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 16 Feb 2012 Link to this post

    Hi.

    I have a ScheduleView with four different ViewDefinitions, all of them loading their own different data.
    In one of the views, the user is able to add/modify multiple appointments before pressing a save button that will save all modifications in a batch.

    Now I want the user to get a warning when he tries to switch to another view without saving first.
    I have an IsModified flag on the appointment, so it is easy for me to check if any appointments are modified and display a warning message with OK/Cancel buttons.

    But how can I prevent the view switch if the user wants to abort?

    Today I have bound ActiveViewDefinition in my view model that will throw an event back to my ScheduleView whenever the view is changed. The problem is that this event will be triggered too late, when the view has already changed.

    So, can I trigger it sooner and can I cancel the view switch somehow?

    Regards,
    Håkan
  2. George
    Admin
    George avatar
    1332 posts

    Posted 21 Feb 2012 Link to this post

    Hello Håkan,

     
    Currently RadScheduleView doesn't support canceling view change because there aren't any events for it. What I could suggest is to return to the previous view (after changing) instead of aborting it.

    Hope this helps.


    Greetings,
    George
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 22 Feb 2012 Link to this post

    Hi George!

    Well, that doesn't work for me unfortunately.
    As soon as I switch view I load other data (each view has it's own data).
    So by the time I switch back, my previous data is already gone.

    Is there anyway to disable the view definition buttons (the ViewModeSelection ListBox)?
    That would be one way for me to prevent the user from switching view.

    The cancelling events would be a nice feature to add in future release though...

    Regards,
    Håkan
  5. George
    Admin
    George avatar
    1332 posts

    Posted 27 Feb 2012 Link to this post

    Hi,

     
    Yes, you can disable the view definition button. What I would suggest is editing the control template and manual set IsEnable="False" to these buttons.

    Thank you for your suggestion, we will consider it in our further releases.


    All the best,
    George
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. Håkan
    Håkan avatar
    183 posts
    Member since:
    May 2011

    Posted 27 Feb 2012 Link to this post

    Hi George!

    Well, but I need to disable the buttons for a specific case, so I can not hard code it in the template.
    Can I bind the IsEnable property to something that can be changed during runtime?

    Regards,
    Håkan
  7. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 02 Mar 2012 Link to this post

    Hi,

    You can bind the IsEnabled property.

    Another thing you can do is to implement a command binding to the commands associated with the buttons and override their CanExecute  methods.

    DayView button is associated with command

    SetDayViewMode Command

    WeekView button is associated with command

    SetWeekViewMode Command


    MontView button is associated with command

    SetMontViewMode Command

    More about commands you can read here.
    More about command binding you can read here
    Regards,
    Rosi
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top
DevCraft banner