Our powerful JS Calendar component


Post by droptableusers »

Dear Bryntum,

We would like to ask for your help regarding the following issue. We need an Excel export that only generates an export for a specific day and for certian resource. As fas as I can see, the export function has a configuration where we can specify which rows to export. Unfortunately, this is not working, because no matter how I filter the events, it always returns all of them.

tbar={{
	items: {
	    export: {
		type: 'button',
		text: 'Exportálás',
		icon: 'b-fa b-fa-file-excel',
		onClick: () => calendar.current?.instance.features.excelExporter.export({
		    rows: eventStore.records.filter((record: Model) => {
			console.log(record);
			console.log(record.getData('resourceId'));
			console.log(ResourceID.SZERVIZ_KOZPONT);
			return record.getData('resourceId') === ResourceID.SZERVIZ_KOZPONT;
		    }),
		})
	    },
	},
}}

I really appreciate your answer.

Best Regards,
Adri


Post by ghulam.ghous »

This is not configurable as you cannot find the rows documented on Excel Export for calendar in the docs here: https://bryntum.com/products/calendar/docs/api/Calendar/feature/experimental/ExcelExporter

But you there is a very easy workaround this:

tbar={{
	items: {
	    export: {
		type: 'button',
		text: 'Exportálás',
		icon: 'b-fa b-fa-file-excel',
		onClick: () => {
        calendar.eventStore.filter((record: Model) => {
			console.log(record);
			console.log(record.getData('resourceId'));
			console.log(ResourceID.SZERVIZ_KOZPONT);
			return record.getData('resourceId') === ResourceID.SZERVIZ_KOZPONT;
		    }),
         calendar.current?.instance.features.excelExporter.export()
        calendar.eventStore.clearFilters()
},
	    },
	},
}}

If you already have some filters applied, then you can add a filter using addFilter and provide an id and then delete it after export using that id.


Post Reply