You need to sign in to do that
Don't have an account?
onChange Rerendering entire page instead of dynamic component
I have a pageblock with a picklist that should trigger a rerender of a dynamic component in another pageblock when a value of the picklist is changed. Depending on the value I will create diferent fields to populate the dynamic component. BUT the problem is that when I select one of the values in the picklist the entire page is refreshed and not the dynamic component. I checked the debug logs and the params are being sent to the controller correctly but for some reason the entire page is refreshing.
<apex:column headerValue="Line type"> <apex:actionRegion id="lnTypeRgn"> <apex:inputField value="{!SOI.Line_Type__c}" id="fLineType"> <apex:actionSupport event="onblur" reRender="detailBlock" action="{!dummyProp}" > <apex:param name="currSOIid" value="{!SOI.Id}" assignTo="{!currSOIid}"/> </apex:actionSupport> </apex:inputField> </apex:actionRegion> </apex:column>
CurrSOI would be the record in row being changed. The debug log show the ID is being passed correctly as well as the Line Type value:
these are the controller methods being invoked
//Sales Order Item Detail Methods:////////////////////////////////////// public PageReference dummyProp() { system.debug('###### CurrSOI: ' + currSOI); return null; } public Component.Apex.PageBlockSection getLoadSOIDetComponent() { //Create teh dynamic component to populate with other components depending on the selected LineType Component.Apex.PageBlockSection section = new Component.Apex.PageBlockSection (collapsible = True,title = 'Sales Order Item Details: ',showHeader = True); List<Sales_Order_Item_Detail__c> SOIdets; system.debug('#### DETCOMP- CurrSOI: ' + currSOI); if(currSOI <> null) { //get curr LineType String lnType = getcurrLineType(); System.debug('#### currLineType: ' + getcurrLineType()); //validate which line type is selected and create the correct components: if(lnType == 'Course') { //load the required fields and also component to add contacts(course registrations) section.title = 'Sales Order Item Details: Course'; Component.apex.PageBlockSectionItem pbsi = new Component.apex.PageBlockSectionItem (); //add the input fields of the SOI to the dynamic component: Component.apex.inputField courseNo = new component.apex.inputField(value = currSOI.Course_No__c); Component.apex.inputField courseStartDate = new component.apex.inputField(value = currSOI.Contract_Start_Date__c); pbsi.childComponents.add(courseNo); pbsi.childcomponents.add(courseStartDate); section.childComponents.add(pbsi); //then need to add a course registration component to link to contacts: system.debug('##### section: ' + section + ' -- ' + courseNo + ' - ' + courseStartDate); return section; }else if (lnType == 'Resource'){ section.title = 'Sales Order Item Details: Resource'; system.debug('##### section: ' + section); return section; }else if (lnType == 'Item'){ section.title = 'Sales Order Item Details: Item'; system.debug('##### section: ' + section); return section; } } //it is a new Sales Order and therefore no SOIs loaded, send back null section section.title = 'Sales Order Item Details: NULL'; system.debug('##### section: ' + section); return section; }
and this is a debug log written when the onchange is fired on the picklist. There is another debug log written immediately afterwards when the page is refreshed.
|DEBUG|#### DETCOMP- CurrSOI: SCRB_SalesOrderLineItem__c:{CurrencyIsoCode=DKK, ProductId__c=01tD0000002ZU9rIAG, Name=a07M0000000eOh4, Id=a07M0000000eOh4IAE, etc...
|DEBUG|#### currLineType: Course
|DEBUG|##### section: Component.apex.pageblocksection -- Component.apex.inputfield - Component.apex.inputfield
Can anyone figure out why the components are not rendering as they should????