Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Andy on Sep 05, 2009 23:11
open dhtmlx forum
More Variabel

I need to store one more value at dhtmlxgrid exclude the cell display value.
any variabel i can use to store this value
Answer posted by dhxSupport on Sep 07, 2009 01:34
Answer posted on Sep 07, 2009 02:23
i want to create a new excell for grid..
here is my code...
function eXcell_LinkPop(cell){
var temp;
    if (cell){
        this.cell = cell;
        this.grid = this.cell.parentNode.grid;
    }
    this.edit = function(){
        var value = getvalue();
        this.cell.innerHTML = "<input type="text" value=\""+value+"\n>);
        this.cell.childNodes.onclick=function(e){ (e||event).cancelBubble=true; }
    }
    this.setValue=function(val){
    var rssplit = val.split("^");
        this.setCValue(rssplit[0]+" "+rssplit[1]);
        temp = val; (i need to store the original value)
    }
    this.getValue=function(){
        var val = temp; (i need to get the original value)
        return this.cell.innerHTML;
    }
    this.detach=function(){
         return this.val!=this.getValue();

    }
}
eXcell_LinkPop.prototype = new eXcell;

the input at cell should be abc^<a href="abc.html" >Link</a>

how can i store the orginal value??
i think i cannot use your last suggestion because i need to store not at the cell.
thanks

Answer posted by dhxSupport on Sep 07, 2009 07:02
>>how can i store the orginal value??
You can store original cell value at the cell's object property:

this.setValue=function(val){
var rssplit = val.split("^");
this.setCValue(rssplit[0]+" "+rssplit[1]);
   this.temp=val
}
this.getValue=function(){
  var val = this.temp;
return this.cell.innerHTML;
}

Answer posted on Sep 07, 2009 21:08
Dear dhtmlx support,
i follow your suggestion already but i got error.
the variabel this.temp is undefined at this momment.
btw where can i define this temp variabel.
because when i define temp variabel use below code is not work.
function eXcell_LinkPop(cell){
var temp;
    if (cell){
        this.cell = cell;
        this.grid = this.cell.parentNode.grid;
    }
    this.edit = function(){
        var value = getvalue();
        this.cell.innerHTML = "<input type="text" value=\""+value+"\n>);
        this.cell.childNodes.onclick=function(e){ (e||event).cancelBubble=true; }
    }
    this.setValue=function(val){
    var rssplit = val.split("^");
        this.setCValue(rssplit[0]+" "+rssplit[1]);
        this.temp = val;
    }
    this.getValue=function(){
        var val = this.temp;
        return this.cell.innerHTML;
    }
    this.detach=function(){
         return this.val!=this.getValue();

    }
}
eXcell_LinkPop.prototype = new eXcell;
very appreciate if you can give me the solution..
Thanks
Answer posted on Sep 12, 2009 21:16
Hi dhtmlx support...
How about this question...
Answer posted by Support on Sep 14, 2009 07:52
If you need to store value persistently , you can update your code as 


   
this.setValue=function(val){
   var rssplit = val.split("^");
   this.setCValue(rssplit[0]+" "+rssplit[1]);
   this.cell.temp = val;
}
this.getValue=function(){
   return this.cell.innerHTML;
}
this.getSecondValue=function(){
     return this.cell.temp;
}


And use
    mygrid.cells(id,ind).getSecondValue();
To get second part of value from the cell.    

while this.temp saves data for current access session only, this.cell.temp will save data for row existence time.