setDataAtCell function inside grid settings calling same column

Tags: #<Tag:0x00007f8b2b79ab40>

Hi,

I am trying to modify the column values using setDataAtCell(). But its failing.

this.hot.updateSettings(){
cells:this.highlightCheckboxCells
}

highlightCheckboxCells = (row,col,prop) =>{

var column = prop.split(".")[0];

var value = this.hot.getDataAtCell(row, column) != null ? this.hot.getDataAtCell(row, column).value : null;

if(value != null && this.objMap.has(column)){

const keys = Array.from(this.objMap.keys());

for(let key of keys){

var selObj = Array.from(this.objMap.get(key));

selObj.forEach(selValue=>{

  if(selValue['value'] == value){

    this.hot.setDataAtCell(row,col,false);==> after setting the values, it should get the next column, but its keep on getting same column again and again.
  }

});

}

}

}

Hi @revathi.nl

Without a demo, can be hard to find a solution.
Can you attach a demo where we can reproduce the issue? Please describe all the steps to do so.

var objArr = [{place :{value:‘chennai’,selected:true},name : { value: ‘AAA’, selected: true },
{place :{value:‘chennai’,selected:true},name : { value: ‘BBB’, selected: true }]

In the above Object Array, I am tying to change the selection from true to false for the name ‘AAA’

afterChange = (row, property, oldValue, newValue) => {

if(property === ‘edit’){

this.checkBoxRows();

}

checkBoxRows(){
this.hot.updateSettings({
cells: this.highlightCheckboxCells
});
}

highlightCheckboxCells = (row,col,prop) =>{

const keys = Array.from(this.objMap.keys());
for(let key of keys){
var selObj = Array.from(this.objMap.get(key));
selObj.forEach(selValue=>{
if(selValue[‘value’] == value){
this.hot.setDataAtCell(row,col,false); ==> only for the first cell I am able to change.
}

});
}
For the next row, its not picking up second row value.

I mean a working demo.

I highly recommend using CodeSandbox or JSFiddle.
Below are base demos that you can use to pass your code

Thanks in advance.

Thanks for your reply. From the demo shared, I want to get all row and column index from the table for the column A.

I’m confused.

First, you wanted column values using setDataAtCell.

And now you want to get all row and column index from the table for column A.
We don’t have a method to this. If you use an array as data source, you have to iterate over this array to get this information.

It would help a lot if you show your implementation.

Thank you. Issue got solved.

I’m glad to hear that.

Thanks for the update.