Flexmonster provides a context menu for the grid and charts where you can drill through values, open filters, change aggregations, and perform other actions.
The context menu can be customized using the customizeContextMenu API call. You can add, remove, and edit menu items.
To see different examples of customizing the context menu, visit our Examples page.
As an input parameter, the customizeContextMenu API call takes a function in which the context menu can be customized. The following data is passed to this function:
The parameter function must return an updated array of ContextMenuItemObjects.
A context menu item can be removed by deleting the corresponding object from the array of ContextMenuItemObjects. The following code removes the Aggregation item from the context menu:
function customizeContextMenuFunction(items, data, viewType) {
items = items.filter(function(item) {
return item.label !== "Aggregation"
});
return items;
}To add a new item to the context menu, insert a ContextMenuItemObject with the needed functionality to the array of items. In the following example, we add a Show grid and charts option to the context menu:
function customizeContextMenuFunction(items, data, viewType) {
items.push({
label: "Show grid and charts",
handler: function() {
pivot.showGridAndCharts();
}
});
return items;
}To customize the context menu based on a view type, use the viewType parameter. In the code, we are customizing the context menu for the flat view:
pivot.customizeContextMenu(function(items, data, viewType) {
if (viewType == "flat") {
items.push({
label: "Switch to charts",
handler: function() {
pivot.showCharts();
}
});
}
return items;
});To disable the context menu, return an empty array in the parameter function of the customizeContextMenu API call:
function customizeContextMenuFunction(items, data, viewType) {
return [];
}Can't find your answer?
Visit the FAQ
Flexmonster Pivot Table & Charts is a JavaScript pivot table component for adding interactive reporting and data analysis to web applications. Users can summarize, filter, sort, and explore data in pivot tables and charts, drill into results, and export reports.
Flexmonster works in plain JavaScript and TypeScript projects. It also integrates with React, Next.js, Angular, Vue, Blazor, and other technologies. See all integration options.
Flexmonster supports JSON and CSV files, SQL databases, MongoDB, Elasticsearch, and Microsoft Analysis Services (SSAS). You can also connect other data sources through your own backend. See supported data sources.
Flexmonster offers licenses for internal corporate use, SaaS products, and OEM distribution. Pricing varies by license and plan. SaaS projects can also use the free SaaS Entry license during development. Learn more on the pricing page.
Yes. Flexmonster offers a 30-day free trial that lets you evaluate all its features. No credit card is required. The trial version has a watermark.
To get started with Flexmonster, follow our integration guide.