We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add filtering of Schedule data based on user selection?

Thread ID:

Created:

Updated:

Platform:

Replies:

147074 Aug 30,2019 06:23 PM UTC Sep 5,2019 01:07 PM UTC ASP.NET MVC - EJ 2 3
loading
Tags: Schedule
Richard Werning
Asked On August 30, 2019 06:23 PM UTC

I have a requirement to allow users to filter the events shown in the Schedule component, by giving them a dropdown list of some option such as the event type, or customer.  I'm having trouble figuring out how to do it, and haven't been able to find anything in the help documentation or searching the forums. We're using ASP.NET and the EJ2 components, version 17.1.50

The Schedule component is declared in the Index.cshtml similar to this:

        <div class="content-wrapper">
            @(Html.EJS().Schedule("eventSchedule")
                  .Width("100%")
                  .Height("650px")
                  .SelectedDate(DateTime.Today)
                  .CurrentView(View.Month)
                  .AllowDragAndDrop(false)
                  .AllowResizing(false)
                  .EventSettings(es => es.EnableTooltip(true).TooltipTemplate("#EventTooltipTemplate")
                      .DataSource(dataManager => { dataManager
                          .Url(Url.Action("LoadRecords", "Schedule"))
                          .CrudUrl(Url.Action("UpdateData", "Schedule"))
                          .Adaptor("UrlAdaptor");
                      })
                  )
                  .Render()
            )
        </div>

The controller action is declared as:
public ActionResult LoadRecords(string StartDate, string EndDate) {
 [...]
}

2 questions with this issue:
  1) How can I pass additional parameters to the controller so I can filter the data as needed?
  2) How can I add a component such as a DropDownList to the Schedule toolbar, to the right of the Date selection that is already there?

thank you
Rich W

Nevitha Ravi [Syncfusion]
Replied On September 2, 2019 08:58 AM UTC

Hi Richard, 

Greetings from Syncfusion Support. 

Q: How can I pass additional parameters to the controller so I can filter the data as needed? 
You can pass additional parameter using addparams method in Query. Please refer the following UG link for your reference. 
 
Q: How can I add a component such as a DropDownList to the Schedule toolbar, to the right of the Date selection that is already there? 
The dropdownlist can be added to the scheduler toolbar using actionBegin event.  Please refer the following code for the same. 
 
<div> 
    @(Html.EJS().Schedule("schedule") 
        .Width("100%") 
        .Height("550px") 
        .ActionBegin("onActionBegin") 
        .SelectedDate(new DateTime(2018, 2, 15)) 
        .Render() 
    ) 
</div> 
<script type="text/javascript"> 
    var profilePopup; 
    function onActionBegin(args) { 
        if (args.requestType === 'toolbarItemRendering') { 
            var sportsData = [ 
                { Id: 'Game1', Game: 'American Football' }, 
                { Id: 'Game2', Game: 'Badminton' }, 
                { Id: 'Game3', Game: 'Basketball' }, 
                { Id: 'Game4', Game: 'Cricket' }, 
                { Id: 'Game5', Game: 'Football' }, 
                { Id: 'Game6', Game: 'Golf' }, 
                { Id: 'Game7', Game: 'Hockey' }, 
                { Id: 'Game8', Game: 'Rugby' }, 
                { Id: 'Game9', Game: 'Snooker' }, 
                { Id: 'Game10', Game: 'Tennis' }, 
            ]; 
            var userIconItem = { 
                align: 'Left', type: 'Input', template: new ej.dropdowns.DropDownList({ dataSource: sportsData, width: 120, index: 2, fields: { text: 'Game' }, }) 
            }; 
            args.items.push(userIconItem); 
        } 
    } 
</script> 
 

Regards, 
Nevitha 


Richard Werning
Replied On September 4, 2019 07:26 PM UTC

Thank you, that was enough to help me solve the issue.

Vengatesh Maniraj [Syncfusion]
Replied On September 5, 2019 01:07 PM UTC

Hi Richard, 
 
We are happy that our solution fulfils your requirement. 
 
Regards, 
Vengatesh 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon