priya Avanigadda

priya Avanigadda

  • 1.8k
  • 45
  • 2.1k

How to implement a Context Menu when click on table cell?

Jul 3 2018 7:51 AM
Hi,
I have pivot table and I need to display the context menu when I click on pivot table cell(the table created dynamically) can any one help me how to write the code to achieve this?
 
I wrote a sample code to generate a alert when I click on table cell, the below is code sample
 
$(function () {
$.getJSON("http://localhost:56453/Scripts/mps.json", function (mps) {
$("#output").pivotUI(mps, {
rows: ["Nationality"],
cols: ["Stage","Language"],
aggregatorName: "Count",
vals: ["Age"],
rendererName: "Heatmap",
rendererOptions: {
table: {
clickCallback: function (e, value, filters, pivotData) {
var names = [];
if (value != null) {
pivotData.forEachMatchingRecord(filters,
function (record) { names.push(record.Name); });
alert(names.join("\n"));
}
}
}
}
});
});
});
 
Instead of alert I need to generate the context menu , can any one help me how to do this??
Am sharing the image ,for clear info ,kindly check the attached image
 

Attachment: PivotTable.zip