0

I have this below class where i am cloning rows with values from previous rows to current one. I am able to clone the rows but at every clone i am getting the 1st row values.

I am not getting the values of the row which i clicked. I am afraid i am not able to get the row index.

Class - 


       public void testclone(){

            for (Integer idx=0; idx<sdf; idx++)
            {
                Test_Detail__c a = wrappers[0].werc.clone(false, true, false, false);
                wrappers.add(new TestWrapper(nextIdent++,a));
            } 
        }
6
  • are these rows static or dynamic? if dynamic then, you can use <apex:variable> to get the index and pass the index to controller Nov 2, 2016 at 19:01
  • 1
    Shouldn't it be Test_Detail__c a = wrappers[idx].testserv.clone(false, true, false, false); ?
    – o-lexi
    Nov 2, 2016 at 19:02
  • all the rows are dynamic... Nov 2, 2016 at 19:06
  • then put your dynamic coding into the question Nov 2, 2016 at 19:07
  • Hi Oleksiy.. I didnt get u.. Nov 2, 2016 at 19:07

1 Answer 1

0

Currently you referencing always to wrappers[0], should change it.

Test_Detail__c a = wrappers[idx].testserv.clone(false, true, false, false);

5
  • Still i am getting the values of 1st row ..I think we need to pass the rowindex instead of <apex:param name="addCount" value="1" assignTo="{!addCount}" /> Nov 2, 2016 at 19:16
  • What are you trying to accomplish? Does the clone should work only on specific row? should it clone all the rows?
    – Liron C
    Nov 2, 2016 at 19:26
  • whichever row i click .. it should clone that row.. Nov 2, 2016 at 19:29
  • what we need to pass? Nov 2, 2016 at 20:11
  • You should pass the row index. <apex:param name="addCount" value="{!wrapper.ident}" assignTo="{!addCount}" /> later in the function you need to write: for (Integer idx=0; idx<addCount; idx++) { if(wrapper[idx].indIdent == addCount){ Test_Detail__c a = wrappers[idx].testserv.clone(false, true, false, false); wrappers.add(new TestWrapper(nextIdent++,a)); } }
    – Liron C
    Nov 3, 2016 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .