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. Image for the cookie policy date

Schedule filter with dropdownlist

Hi,

How to implement a filter looking for the EventType?

I created a dropDown with a list of colors using onActionComplete().

I would like to filter by this list.


1 Reply

RV Ravikumar Venkatesan Syncfusion Team February 2, 2023 06:17 PM UTC

Hi Alexandre,


Sample: https://stackblitz.com/edit/ej2-angular-schedule-filter-apps-based-on-color?file=src%2Fapp.component.ts


You can filter the Schedule appointments based on color using the DropDownList on Schedule actionComplete event as shown in the below code snippet.


[app.component.ts]

  public onActionBegin(argsActionEventArgs) {

    if (args.requestType === "toolbarItemRendering") {

      let colorDdlItemModel = { align: 'Right'template: ' <input type="text" id="category-color"/>'type: 'Input' };

      args.items.push(colorDdl);

    }

  }

 

  public onActionComplete(argsActionEventArgs) {

    if (args.requestType === "toolBarItemRendered") {

      let colorObjDropDownList = new DropDownList({

        dataSource: [

          { text: "Green"value: "#1aaa55" }, { text: "Light blue"value: "#357cd2" }, { text: "Light green"value: "#7fa900" },

          { text: "Dark salmon"value: "#ea7a57" }, { text: "Light sea green"value: "#00bdae" }, { text: "Orange"value: "#f57f17" }

        ],

        fields: { text: "text"value: 'value' },

        placeholder: 'Select a color',

        change: (argsChangeEventArgs=> {

          const resultDataRecord<stringany>[] = this.data.filter((appointment=> { return appointment.CategoryColor === args.value });

          this.scheduleObj.eventSettings.dataSource = resultData.length > 0 ? resultData : [];

        }

      });

      colorObj.appendTo('#category-color');

    }

  }


Regards,

Ravikumar Venkatesan


Loader.
Live Chat Icon For mobile
Up arrow icon