Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Jason on Apr 13, 2009 17:34
open dhtmlx forum
Copying Row

What is the easiest way to copy a row and insert the new row at the end. I want to copy the row at some point. And have that saved somewhere so I can use it at a later time. The row I copied from will get changed and those changes need not reflect in the copy of the row. What's the best method to save a copy of a row for later use and then paste the row at the end of the grid when needed (of course I will need to update the rowid, but I can do that).
Answer posted by dhxSupport on Apr 14, 2009 02:16

Pro version of dhtmlxGrid has extentions: coping selected row to the clipboard and serialize grid to the csv format. You can use this extentions to save certain row. Please see more information here

http://dhtmlx.com/docs/products/dhtmlxGrid/samples/clipboard/pro_clipboard.html

http://dhtmlx.com/docs/products/dhtmlxGrid/doc/guide.html#grid_csv

http://dhtmlx.com/docs/products/dhtmlxGrid/doc/guide.html#grid_excel

While adding new row you can set new row's values:

addRow(new_id, text, ind)

new_id - row ID, must be unique

text - row values, may be a comma separated list or an array

ind - index of new row, optional, row added to the last position by default

Answer posted by Jason on Apr 14, 2009 10:31
What I am trying to do is give the ability to add a new row with default values. The row contains userdata and also xml data (combo box) within the cell that needs to be processed so I can't just send in an array of values. I need a way to add a row to the end of the grid. The last row of the grid, when it loads, is the row that can be copied to do so. It is a blank row with default values.
Answer posted by dhxSupport on Apr 15, 2009 08:22
Unfortunately dhtmlxGrid hasn't appropriate method which can allow you do that automatically. After adding row you should manually insert user data and xml for the "combo" column.