Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Evgeny on Mar 27, 2008 08:41
open dhtmlx forum
Approach for saving of additional info for each row in the dhtmlx grid

Hi, can you propose some approach for saving additional data for each row in the grid?
for example, I need save for each row 3 additional parameters - id, MatterId, DocId,
and when user click on the row I should make ajax call and post these parameters..
Where I should save it?
sure, I can make additional column and make it hidden -
but you know - function setColumnHidden works slowly, so
it is bad approach...

maybe you know better aproach?
Answer posted by Support on Mar 27, 2008 09:08
Grid provides ability to store additional data through userdata sections , when data loaded from XML it looks as

   <rows>
       <row id="1">
             <userdata name="MatterId">some value</userdata>
             <userdata name="someId">some value</userdata>
             <userdata name="DocId">some value</userdata>
             <cell>some</cell>
               ...


After loading this value can be set|get by
    grid.setUserData(id,name,value)
    grid.getUserData(id,name); // grid.getUserData(1,"DocId");

If you are using dataprocessor all userdata attached to row will be available on server side ( the name of GET|POST parameters will be equal to the name of userdata )

Answer posted by Evgeny on Mar 27, 2008 09:55
how to it when data loading from html table?
Answer posted by Support on Mar 27, 2008 11:10
In case of loading from HTML, the only way to store additional data - use hidden columns
Answer posted by Evgeny on Mar 27, 2008 11:22
do you planing add this fuctionality? we are purchasinf professional version and very need it...
Answer posted by Support on Mar 28, 2008 03:48
If you are using simple loading mode ( without split ) you can store additional data in attributes of TR tag

    <table id="tblToGrid"  ...
        <tr>
            <td type="ro">Column 1</td>
            <td>Column 2</td>
        </tr>
        <tr attr1="a1" attr2="a2" attr3="a3">
            <td>value 11</td>
            <td>value 12</td>
        </tr>

And to access data
    mygrid.rowsAr['tblToGrid_1'].getAttribute('attr1')
Answer posted by Egveny on Mar 28, 2008 03:56
good think!
thank you!