Need a special offer?Find out if your project fits.
+

How to customize particular cell value on Cell Click without rendering the flexmonster pivot table?

Answered
Lavanya Katika asked on March 18, 2021

On click of a button, I am rendering the Flexmonster table. I have "Phone Number" as one of the columns in the table. On initial rendering, I am masking the phone number from "7234231234 -> value from API response) to (******1234 -> to show in the table). Now when I click on the masked phone number in the column (******1234), I want to see the full phone number only the cell clicked.
Could you please help me how to achieve this???

4 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 18, 2021

Hello,
 
Thank you for reaching out to us.
 
We suggest using the customizeCell hook to implement this functionality.
Our team has prepared the corresponding JSFiddle for the demonstration: https://jsfiddle.net/flexmonster/e9fpkvt4/.
 
You will find a detailed explanation of the code snippet from the example below:

const visibleNumber = { //this object stores coordinates of the visible phone number
  rowIndex: undefined,
  columnIndex: undefined
}

flexmonster.on("cellclick", (cell) => { //every time user clicks on the cell, new coordinates are stored and the grid is redrawn
  visibleNumber.rowIndex = cell.rowIndex;
  visibleNumber.columnIndex = cell.columnIndex;
  flexmonster.refresh();
});

flexmonster.customizeCell((cell, data) => { //this function will be executed for each cell. It checks if current cell needs to be modified and replaces its content if needed
  if (data.hierarchy &&
    data.hierarchy.uniqueName == "Phone Number" &&
    data.type == "value" &&
    data.label &&
    !(data.rowIndex == visibleNumber.rowIndex &&
      data.columnIndex == visibleNumber.columnIndex)) {
    cell.text = "******" + data.label.slice(data.label.length - 4);
  }
});

 
Please let us know if it works for you.
We are looking forward to hearing your feedback.
 
Regards,
Illia

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 24, 2021

Hello,
 
We are wondering if the proposed solution works well for your case.
 
Our team is looking forward to hearing from you.
 
Regards,
Illia

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster April 7, 2021

Hello,
 
We are reaching out to ask if you had some time to check out the provided solution.
 
If so, please let us know if it works for you.
Our team is looking forward to your feedback.
 
Regards,
Illia

Public
Lavanya Katika April 7, 2021

Hello,
Thank you so much for the response. This helped!

Please login or Register to Submit Answer