search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Is clearSelection available?

Asked by Jeff
2 years ago.

I am investigating using DayPilot (ASP.NET Web Forms), and I would like to be able to offer the user an ability to cancel event creation -- I want to then call clearSelection as I have seen in some javascript documentation. Is there a way?

Answer posted by Dan Letecky [DayPilot]
2 years ago.

Yes, the clearSelection() client-side method is available in the ASP.NET WebForms version as well.

You can find an example in the main Scheduler demo:

https://aspnet.daypilot.org/demo/Scheduler/

The selection gets cleared if the modal dialog with new event details is canceled.


<script>

  function dialog() {
    var modal = new DayPilot.Modal();
    modal.onClosed = function (args) {
      if(args.result == "OK") { 
        dps1.commandCallBack('refresh'); 
      }
      dps1.clearSelection();
    };
    return modal;
  }

  function timeRangeSelected(start, end, resource) {
    var modal = dialog();
    modal.showUrl("New.aspx?start=" + start.toStringSortable() + "&end=" + end.toStringSortable() + "&r=" + resource + "&hash=<%= PageHash %>");
  }

</script>

<DayPilot:DayPilotScheduler 
    ID="DayPilotScheduler1" 
    runat="server" 
    ...
    TimeRangeSelectedHandling="JavaScript"
    TimeRangeSelectedJavaScript="timeRangeSelected(start, end, resource)"        
    ClientObjectName="dps1" 
    ...
    ></DayPilot:DayPilotScheduler>
Comment posted by Jeff
2 years ago.

Thank you! The part I was missing was the "ClientObjectName" attribute -- the other examples I found didn't show that, and I couldn't figure out where the "dps1" reference came from.

I appreciate the help.

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.