Summary
A special version of the Grid Summary feature. This feature displays a summary row in the grid footer.
//<code-header>
fiddle.title = 'Summary';
//</code-header>
targetElement.innerHTML = '<p>A demo with column and event summary:</p>';
const scheduler = new Scheduler({
appendTo : targetElement,
// makes scheduler as high as it needs to be to fit rows
autoHeight : true,
features : {
summary : {
renderer : ({ events }) => events.length || ''
}
},
startDate : new Date(2018, 4, 6),
endDate : new Date(2018, 4, 13),
columns : [
{ field : 'name', text : 'Name', width : 100 },
{ field : 'rank', text : 'Rank', width : 100, sum : 'average', summaryRenderer : ({ sum }) => `Average: ${sum}` }
],
resources : [
{ id : 1, name : 'Bernard', rank : 5 },
{ id : 2, name : 'Bianca', rank : 4 },
{ id : 3, name : 'Belinda', rank : 3 }
],
events : [
{ id : 1, resourceId : 1, name : 'Drag around', startDate : '2018-05-07', endDate : '2018-05-10' },
{ id : 2, resourceId : 2, name : 'to update', startDate : '2018-05-08', endDate : '2018-05-12' },
{ id : 3, resourceId : 2, name : 'summaries', startDate : '2018-05-09', endDate : '2018-05-10' },
{ id : 4, resourceId : 3, name : 'below', startDate : '2018-05-09', endDate : '2018-05-10' }
]
});For regular columns in the locked section - specify type of summary on columns, available types are:
| Type | Description |
|---|---|
sum |
Sum of all values in the column |
add |
Alias for sum |
count |
Number of rows |
countNotEmpty |
Number of rows containing a value |
average |
Average of all values in the column |
function |
A custom function, used with store.reduce. Should take arguments (sum, record) |
Columns can also specify a summaryRender to format the calculated sum.
To summarize events, either provide a renderer or use summaries
This feature is disabled by default.
Configs
15
Configs
15Other
Renderer function for a single time axis tick. Should calculate a sum and return HTML as a result.
new Scheduler({
features : {
summary : {
renderer : ({ startDate, endDate, eventStore, resourceStore, events, element }) => {
// return display value
returns '<div>Renderer output</div>';
}
}
}
});
| Parameter | Type | Description |
|---|---|---|
context | Object | Rendering context object |
context.startDate | Date | Tick start date |
context.endDate | Date | Tick end date |
context.events | EventModel[] | Events which belong to the group |
context.eventStore | EventStore | Event store |
context.resourceStore | ResourceStore | Resource store |
context.element | HTMLElement | Summary tick container |
Html content
Array of summary configs which consists of a label and a renderer function
new Scheduler({
features : {
summary : {
summaries : [
{
label : 'Label',
renderer : ({ startDate, endDate, eventStore, resourceStore, events, element }) => {
// return display value
returns '<div>Renderer output</div>';
}
}
]
}
}
});
A config object for the Column used to contain the summary bar.
Misc
Properties
18
Properties
18Common
Class hierarchy
Functions
29
Functions
29Configuration
Events
Misc
Other
Events
5
Events
5Event handlers
5
Event handlers
5Typedefs
3
Typedefs
3Defines a summary, used by the Summary and GroupSummary features.
| Parameter | Type | Description |
|---|---|---|
label | String | Label for the summary |
renderer | function | Function to calculate and render the summary value |
renderer.startDate | Date | |
renderer.endDate | Date | |
renderer.eventStore | EventStore | |
renderer.resourceStore | ResourceStore | |
events | EventModel[] | |
resources | ResourceModel[] | |
groupRecord | Model | |
groupField | String | |
groupValue | Object |