public onActionBegin(args: ActionEventArgs) {
if (args.requestType === "toolbarItemRendering") {
let colorDdl: ItemModel = { align: 'Right', template: ' <input type="text" id="category-color"/>', type: 'Input' };
args.items.push(colorDdl);
}
}
public onActionComplete(args: ActionEventArgs) {
if (args.requestType === "toolBarItemRendered") {
let colorObj: DropDownList = 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: (args: ChangeEventArgs) => {
const resultData: Record<string, any>[] = this.data.filter((appointment) => { return appointment.CategoryColor === args.value });
this.scheduleObj.eventSettings.dataSource = resultData.length > 0 ? resultData : [];
}
});
colorObj.appendTo('#category-color');
}
}
|