Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Alberto on Oct 06, 2008 07:55
open dhtmlx forum
Send customized values to a onRowSelected funcion.

Hello,
i need a function that shows an alert box with 2 values by clicking on a grid row.

I followed the doc., i made the function that show the alert box ... ok ...
but i don't know how to give 2 contextual values to that function...

Ex.
By clicking on row1 the alert must show val1:a val2:b...
By clicking on row2 the alert must show val1:c val2:d...

theese values should be hidden... But if this is a problem a can show them on a cell...

any ideas?

Thanks. AL
Answer posted by Support on Oct 06, 2008 07:58
Grid provides few ways to store hidden data 
http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Storing_additional_data.html#grid_art_userdata

In case of attributes
   <row id="1" val1="a" val2="b" ...
   <row id="2" val1="c" val2="d" ..

It will look as

grid.attachEvent("onRowSelect",function(id){
     alert(this.getRowAttribute(id,"val1")+","+this.getRowAttribute(id,"val2"));
     return true;
});

Answer posted on Oct 06, 2008 08:08
Thank for the quickly answer!
Just 2 things:
 - 1. I cannot find the property: getRowAttribute on API Documentation can you show me where I can find it?
 - unfortunatelly I make my grid in this way mygrid.addRow(3,variabile,3) etc...

Is there a method to setting a rowAttribute... also here I cannot find any docs...

Thanks in adavance, Al.
Answer posted on Oct 06, 2008 08:16
Answer posted by Support on Oct 06, 2008 08:38
>> - 1. I cannot find the property: getRowAttribute on API Documentation can you show me where I can find it?
Yep, while it was mentioned in separate article, main API reference miss description of such method - we will update documentation in nearest time.