Adding custom column

so if I click “Insert column on the left” for “Toyota” I should get two “Toyota” columns that are green?

ya … like that i want @aleksandra_budnik, and one more thing is that the Toyota should not turn to red color, it should alway the color it has(green)… http://jsfiddle.net/hanumantha_reddy/hwze45sb/

thank you for the great support @aleksandra_budnik.

hey @aleksandra_budnik hope you doing good, any updates regarding this issue @aleksandra_budnik, thank you for your kind support.

It is a matter of settings the cells method within updateSettings via afterCreateColumn or - if your dataset is not too long - via setCellMeta.

can i have a jsfiddle for ref or can you please update the following fiddle http://jsfiddle.net/hanumantha_reddy/hwze45sb/ thank you @aleksandra_budnik

I am sorry but it would take some time with tests so we treat it as a commercial service. Do you own an Extended Support plan?

No @aleksandra_budnik,

So that would need to be paid externally. If you wish to schedule it I can create a cost/time for you. But if you’d like to build it on your own I can still help you (propose methods and hooks), I just can’t build it from a scratch.

will try @aleksandra_budnik, if i am not able to follow up i’ll give a text, this is the higher priority work for me, so i am working hard like anything, @aleksandra_budnik thank you for your support.

If you’d encounter any issues let me know.

Sure @aleksandra_budnik thank you… Get back to you soon …

hi … @aleksandra_budnik hope your doing good, nice to text you,
the problem is that,

hot.updateSettings({
cells: function(row, col, prop) {
var cellProperties = {};

  // adding column classes
  if (col > 3) {
    cellProperties.className = 'result_column'
    
  } else {
    cellProperties.className = 'condition_column'
  }
  return cellProperties;
},
contextMenu: {
  items: {
    "col_left": {
      name: "insert column left",
      callback: function(key, options) {
      	myCol = hot.getSelected()[0][1];
        myData = hot.getDataAtCol(myCol); // here we get data from the column
        
        hot.alter('insert_col', myCol);
        
        for(var i = 0; i < hot.countRows(); i++){
        	hot.setDataAtCell(i, myCol, myData[i])
        }
      }
    },
    "col_right": {
      name: "insert column right",
      callback: function(key, options) {
      myCol = hot.getSelected()[0][1];
        hot.alter('insert_col', hot.getSelected()[0][1] + 1)
        // does some things after click
      }
    }
  }
}

})

we are checking the if condition for applying the classes to the columns,
i.e.

cells: function(row, col, prop) {
var cellProperties = {};

  // adding column classes
  if (col > 3) {
    cellProperties.className = 'result_column' // red color
    
  } else {
    cellProperties.className = 'condition_column' // green color
  }
  return cellProperties;
},

so it always add the classes to the column based on this condition, that’s why, if we add the column to left/right it will add but the column condition get executes so it won’t change the column class, so need to figure out how to change this condition dynamically.

http://jsfiddle.net/hanumantha_reddy/hwze45sb/6/

like if they add the column left/right using context menu we should change the column method condition than only we can achive this problem.
thank you @aleksandra_budnik, if you have idea or can you update the able jsfiddle i am also working on that if i get, i’ll get back to you @aleksandra_budnik

hey @aleksandra_budnik good news is that, i completed the requirement successfully… now the handsontable is working as my expectations. thank you for the support @aleksandra_budnik.

solution:
1.
cells: function(row, col, prop) {
var cellProperties = {};

  // adding column classes
  if (col > 3) {
    cellProperties.className = 'result_column'
  } else {
    cellProperties.className = 'condition_column'
  }
  return cellProperties;
},
  1. the hot.updateSettings need to get the current cell length and increment by value 1, than only the new column will create with the same class or property.

@aleksandra_budnik thank you once again, for the great support

So happy to hear that you got it working :slight_smile: great job!