Author Topic: access meta data of cell in context menu action  (Read 1305 times)

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
access meta data of cell in context menu action
« on: August 31, 2021, 08:15:46 pm »
thanks, that will work.  I need to pass the hovertext to a function on right click of the cell. How can I get that from cell?

https://jsfiddle.net/t2zLx5nk/

 contextMenu: {
              on: true,
              items: [{
                name: 'send hovertext',
                action: function test(){ varHover = "how to get the hovertext for this cell?"} }]
  }

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: access meta data of cell in context menu action
« Reply #1 on: September 01, 2021, 10:05:52 am »
Code: [Select]
action: function test(evt, ui){               
  var val = ui.rowData["_" + ui.dataIndx];
  if(val){
  alert(val.split(",")[1]);
  }
}

https://jsfiddle.net/svkctxhw/

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: access meta data of cell in context menu action
« Reply #2 on: November 12, 2021, 12:46:38 am »
Thank you. I need to change the value of a cell's hovertext on right click. Can you tweak the example below on the 'right click' method to change the cell's hover text, rather than calling 'alert()' ?


https://jsfiddle.net/svkctxhw/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: access meta data of cell in context menu action
« Reply #3 on: November 15, 2021, 11:20:40 pm »
It's more related to use of js array manipulation.

Code: [Select]
action: function test(evt, ui){               
  var val = ui.rowData["_" + ui.dataIndx];
  if( val ){
    var arr = val.split(",");
    arr[1] = "new hovertext";
    ui.rowData["_" + ui.dataIndx] = arr.join(",");
    this.refreshCell(ui);
  } 
}

https://jsfiddle.net/4p6ta579/