Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 07, 2007 05:38
open dhtmlx forum
userdata tag

hi,
I have seen userdata tag in xml.
what is its purpose?
Answer posted by Support on Dec 07, 2007 06:22
It can be used to transfer additional data which can be used for some purpose on clientside

<row id="123">
    <userdata name="mark">value</userdata>
     <cell>1</cell>
     <cell>2</cell>
</row>

var mark=mygrid.getUserData(123,"mark"); //get value stored in XML
Answer posted on Dec 07, 2007 06:38
It looks userdata tag on row basis.
Can we have userdata tag on cell basis?
Can we set userdata on editing cell?
like:-
 doOncellEdit(){
    mygrid.setUserdata("rowInd_cellInd","value");
}
note:- rowInd_cellInd is cell id.
Thanks in advance.

Answer posted by Support on Dec 07, 2007 10:06
The userdata can be global for all grid or per row, there is no possibility to have it per cell tag, but you can use code similar to next


<row id="123">
    <userdata name="cell-0">value0</userdata>
    <userdata name="cell-1">value1</userdata>
     <cell>1</cell>
     <cell>2</cell>


mygrid.attachEvent("onEditCell",function(stage, rid, cind,value){
    if (stage == 2)
        mygrid.setUserdata(rid,"cell-"+cind, value);
    return true;
});
</row>

So while it not really cell based, you can set and get it.