+ Start a Discussion

Getting a rowid of a DataRow in a DataTable


I am trying to write a VF page which can add multiple rows of object. Now during data capture there is a lot of data repeatation happening, so I plan to add a copy row functionality on the page.


Now as u can c from the figure I did build a VF page but I do not know how do I achieve this functionality.


I have a list called 'Packages' which stores Object of Class 'Field',


Now obviously when I click on Copy I need to know which field to copy and then I can traverse the Package and add the field object data below it.



One approach I thought about it was create a Index variable in Field class and increment it by one in constructor.


However this happens to be a workaround, is there any standard way to do this? 


Any suggestions will be helpful.


Unfortunately I can't see the image :(


However, I think what you are doing is correct, unless there is another unique identifier in the Field class (an sObject id is always the best, if there is one in there somewhere).  You need to pass something back to the controller to allow it to uniquely identify the object that you wish to copy, and this is as good a way as any.


Hey Bob, I uploaded the picture as a static resource, I believe its not accessible. I will get it on some freehost soon.


Yes the Sobject Id was my first priority, but the problem is the functionality works before insert. so there is no way of getting a ID on the page. 


I will try with the Custom Cooked Id thing, if there is some way in identified data table row, I am all ears.