Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jon on Sep 02, 2008 22:28
open dhtmlx forum
GRID: Get a reference to the grid in which a custom eXcell lives.

Hi,

I have a custom eXcell which renders a button to add/delete rows in the grid. I am using this custom eXcell in MULTIPLE grids on the same page.

My question: How can I get the ID of the grid into which the custom eXcell is being added, in order to use this information in the custom eXcell's event-handler?

IE:
My code currently looks something like this...

eXcell_button.prototype.setValue = function(val){
var row_id='"'+this.cell.parentNode.idd+'"';
sHTML = "<a href='#' onclick='handleAddRow("+row_id+");'></a>";
this.setCValue(sHTML,val);
}

I need to reference the name of the grid (or the grid object itself) the eXcell button resides in, so I can pass it as an argument to my "handleAddRow()" function. Something like...

eXcell_button.prototype.setValue = function(val){
var row_id='"'+this.cell.parentNode.idd+'"';
var grid_id= [ THE VARIABLE NAME OF THIS GRID / OR A REFERENCE TO THE GRID !!! ] <------------ HOW ???
sHTML = "<a href='#' onclick='handleAddRow("+grid_id+", "+row_id+");'></a>";
this.setCValue(sHTML,val);
}

Thanks,
Jon.






Answer posted by Support on Sep 03, 2008 02:00
If you are using same code for excell as in samples then you can use this.grid - as reference to the grid object;
function eXcell_[custom](cell){
 if (cell){
  this.cell=cell;
  this.grid=this.cell.parentNode.grid; //here reference to the grid object stored.

If you have grid object, ID of its container can be taken as 
   grid.entBox.id