Categories | Question details Back To List | ||
AddRow through link in dhtmlxTreeGrid Hello, I added the library <script src="../../../dhtmlxGrid/codebase/excells/dhtmlxgrid_excell_link.js"></script> to be able to use columntype "link" in our celldata The link should execute a function or code to add a row right under the row from which we pressed the 'add row' link I tried with : <cell>add^javascript:mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,0],0)</cell> <cell>add^javascript:mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,0],0);mygrid.refreshGrid()</cell> <cell>add^javascript:mygrid.addRow((new Date()).valueOf(),['new row','text','text',1,0],0)^_self</cell> I'm new to JS programming, so I wonder what's the best technique to achieve this. Thanks, Yves Answer posted by Support on Feb 18, 2009 05:01 The common approach is <cell>add^javascript:my_add()^_self</cell> and somewhere in js code define function my_add(){ mygrid.addRow(mygrid.uid(),['new row','text','text',1,0],0); } Also, you can use any plain column type instead of link and assign the same functionality through event grid.attachEvent("onRowSelect",function(id,ind){ //for each click if (ind==5) // if action cell clicked ( 5 is just a sample of index ) my_add(); return true; }) |