function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
neao18neao18 

Hold Modified values in StandardSetContoller with pagination!!

Hi all,

 

My senario is that I have a Page with Multiple select options and Pagination(Using wrapper class). 

What happen is this when I change my values in page and navigate to next set of records using StandardSet controller next() methord I run into this error..

 

 

"Modified rows exist in the records collection!"

 

So I tried to again make my controller object null and again bind the record list with it but same issue.

 

What to do in this senario!!

 

public void pnext(){
    if(recList != null){
        tempmapofWRP = new Map<Id,boolean> ();
        List<PO_LineItem__c> tempUpdatePOLINE = new List<PO_LineItem__c>();
        for(wrapperRec wrp: recList){
            wrpMap.put(wrp.record.Id,wrp) ;
            tempmapofWRP.put(wrp.record.Id,wrp.check);
        }
        for(wrapperRec wrp:wrpMap.values()){
            tempUpdatePOLINE.add(wrp.record);
        }
        validationRec();
        con.save();
        system.debug('***con before null*****'+con);
        system.debug('***con after null*****');
        system.debug('****tempUpdatePOLINE****'+tempUpdatePOLINE);
        
        /*con = null;
        con = new ApexPages.StandardSetController(tempUpdatePOLINE);
        con.setPageSize(10);
        */
        system.debug('***con new bind*****'+con);
        system.debug('****before caon next*****');
        con.next();
        system.debug('***Next called ****');
        wrltemplist =  new List<wrapperRec>();
        system.debug('***before getrecordcall *****');
        wrltemplist  = getrecordList();
        for(wrapperRec wrp: wrltemplist ){
            if(wrpMap.containsKey(wrp.record.Id)){
                wrp.check=wrpMap.get(wrp.record.Id).check;
            }
        }
    }
    else{
        wrltemplist =  new List<wrapperRec>();
        wrltemplist  = getrecordList();
    }
}  

 

 

Adam HowarthAdam Howarth

Can you not just update the collection at the start of the next method?

neao18neao18

Sorry but that didn't helped!!