• Joe Zuqing Li
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi everyone, I have one issue related to the rerender attribute, could you please kindly help take a look if any resolution, many thansk in advance.

Issue Details:
I have one visualforce page A in which contains a component B and this component also has included another component C in it. in Page A, I also have a footer component in which it will call out once during page loads. while in Component C, I have one link, by which if clicked, it should render the Panel(id=feedbackContainer) in Component C self. however for now, I notice that when I click the link in Component C, it caused the whole Page A refreshed and rendered, which results in the call out triggered and system popup error saying "You have uncommitted work pending. Please commit or rollback before calling out", I suspect this is all because the rerender attr in Component has wrongly rendered its scope, it should render only the section to the id specified, but actually it refreshed the whole Parent page.

Particial Source Code shown as below:
----------------------------------------------------------------------------------------------------------------------
Visualforce Page A:
<!--Article Detail-->
        <apex:outputPanel rendered="{!viewingArticle}">
        <div class="l-wrapper">
          <div class="contentBox">
            <c:pkb_search pkbCon="{!pkbCon}" />
            <c:pkb_topicpath pkbCon="{!pkbCon}" isUQ="true"/>
            <c:pkb_articleview pkbCon="{!pkbCon}" showFeedbackYesNo="true" showBackLinks="true" />
          </div>
          <div class="globalNavi">
            <c:pkb_narrow pkbCon="{!pkbCon}" isGlobalNavi="true"/>
          </div>
        </div>
        </apex:outputPanel>
         <div id="footer">
           <c:pkb_footer pkbCon="{!pkbCon}"/>   <!-- in this component, there is one call out fucntion once the page loaded-->
         </div>
         .....
----------------------------------------------------------------------------------------------------------------------
Component B:
   ...
  <apex:outputPanel layout="block" styleClass="feedbackContainer" rendered="{!showFeedbackYesNo}">
    <c:pkb_feedbackyesno pkbCon="{!pkbCon}" />  <!--  include Component C here-->
  </apex:outputPanel>
  ...
----------------------------------------------------------------------------------------------------------------------
Component C:
...
<apex:outputPanel id="feedbackContainer">
<section class="section">
  <apex:form id="feedbackYesNoForm">
  <apex:actionFunction name="submitFeedback" action="{!pkbCon.recordArticleFeedback}" rerender="feedbackContainer" status="feedbackStatus" />
<!--1. Feedback Yes/No form-->
  <apex:outputText rendered="{!NOT(pkbCon.feedbackRecorded)}">
  <h3 class="question-title">{!$Label.PKB2_Was_Helpful}</h3>
<div id="feedback" class="question-select l-content-inner clearfix">        
        <div class="question-select-y">
          <apex:commandLink id="question-yes" styleclass="btncust btn-white btn-question" value="Yes" action="{!pkbCon.deferred}" rerender="feedbackContainer" status="feedbackYesNoStatus"/>
        </div>
        <div class="question-select-n">
          <a href="#" id="question-no" class="btncust btn-white btn-question">No</a>
        </div>

    <apex:actionStatus id="feedbackYesNoStatus">
      <apex:facet name="start"><apex:image value="{!$Resource.pkb_loadingdots}" /></apex:facet>
      <apex:facet name="stop"></apex:facet>
    </apex:actionStatus>
</div>
...
----------------------------------------------------------------------------------------------------------------------
Controller
...
    public void deferred() {
      createDeferral(true);
      feedbackRecorded = true;
        system.debug('*****************deferred'+feedbackRecorded);
    }
...
----------------------------------------------------------------------------------------------------------------------

is there any part in my code that caused this issue, kindly please help figure it out. I just cannot make it through.
It would be of greate help. Many thanks in advance.

 

This is just some example code, I don't want the focus of what I'm doing to cloud the concept I'm trying to figure out.

 

code:

 

sobject[] something = [SELECT Contact.FirstName, Contact.Account.Name, contact.account.type from Contact];

 

I've used sobject[] here instead of contact[] because in my project the query is dynamic and could be from a different table.

 

My question is, how do I get the relationship field from this? Normally, I know you can do this:

 

string theName = something[0].Account.Name;

 

However, this results in the error: Field expression not allowed for generic SObject

 

How do I get around this?

  • April 29, 2012
  • Like
  • 1