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

customizeCell

Re-Open
MayurSinh asked on July 25, 2020

hello can we pass javascript function in
pivot.customizeCell((cell,data)=>${this.custimiseCellFunction(cell,data)})
 
i’m not getting cell and data how i can implement my logic in html..

ello i'm getting cell and data from the pivot.customCell(cell,data) in react-native ny belove function.

pivot.customizeCell((cell,data) => {
                    var response = {
                        type: "event",
                        name: "customizeCellFunction",
                        data: data,
                        cell: cell
                    };
                    window.ReactNativeWebView.postMessage(JSON.stringify(response));
  })
then after i modified cell from react-native side like belove code. how can i applied into flexmonster ? please help me.

customizeCellFunction = (mainData,mainIndex) => {

let cell = mainData.cell
let data = mainData.data
 
if (data.isClassicTotalRow)
cell.addClass("fm-total-classic-r");
// Grand Total
if (data.label == "Grand Total") {
if (data.isGrandTotalRow) {
this.fmCell.isGrandTotalRow = true;
this.fmCell.isGrandTotalColumn = false;
// Sub Total
this.fmCell.isTotalRow = false;
this.fmCell.isTotalColumn = false;
} else if (data.isGrandTotalColumn) {
this.fmCell.isGrandTotalColumn = true;
this.fmCell.isGrandTotalRow = false;
// Sub Total
this.fmCell.isTotalRow = false;
this.fmCell.isTotalColumn = false;
}
}

// Sub Total
if (data.label != "" && data.label != "Grand Total" && data.label.indexOf(" Total") > 0) {
if (data.isTotalRow) {
this.fmCell.isTotalRow = true;
this.fmCell.isTotalColumn = false;
// Grand Total
this.fmCell.isGrandTotalRow = false;
this.fmCell.isGrandTotalColumn = false;
} else if (data.isTotalColumn) {
this.fmCell.isTotalColumn = true;
this.fmCell.isTotalRow = false;
// Grand Total
this.fmCell.isGrandTotalRow = false;
this.fmCell.isGrandTotalColumn = false;
}
}

 

// Grand Total
if (data.isGrandTotalRow && this.fmCell.isGrandTotalRow) {
cell.addClass("fm-grand-total-border");
}
if (data.isGrandTotalColumn && this.fmCell.isGrandTotalColumn) {
cell.addClass("fm-grand-total-border");
}
// Sub Total
if (data.isTotalRow && this.fmCell.isTotalRow) {
cell.addClass("fm-sub-total-border");
}
if (data.isTotalColumn && this.fmCell.isTotalColumn) {
cell.addClass("fm-sub-total-border");
}

 

// let grand = this.custom_grand_total(data);
// if (grand)
// lodash.set(cell, "text", "mayur");

// let color = this.heatmapservice.get_color(data, this.grid_config.heatmap);
// if (color)
// cell.style["background-color"] = "#FA9172",
lodash.set(cell, "style.background-color", "#FA9172");
console.log("my cell ====>",cell)
}

 
i need to (cell,data) callback in javascript 

1 answer

Public
Vera Didenko Vera Didenko Flexmonster July 28, 2020

Hello, 
 
Thank you for writing to us. 
 
Currently, the known solution is to modify the source code of the module and to define the customizeCell function there.
This approach is described in the following forum thread.
 
Please let us know if this approach works for you.
Looking forward to your response.
 
Kind regards, 
Vera

Please login or Register to Submit Answer