• heuye
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies

below is all my code.when i click the commandButton,the pageBlockName doesn't change,why?

use the component in a page:

 

<c:test_updateAttribute blockName="set in page" />

 

component:

 

 

<apex:component controller="test_sample" access="global">
<apex:attribute name="blockName"
    type="String"
    required="true"
    access="global"
    assignTo="{!pageBlockName}" 
    description="The blockName." />

<apex:pageBlock title="{!pageBlockName}" id="resultTable">
<apex:commandButton value="change blockName" action="{!changeName}" reRender="resultTable"/>
</apex:pageBlock>   
</apex:component>  

 

component controller:

global with sharing class test_sample{
    public String pageBlockName {get; set;}
   
    public void changeName(){
        pageBlockName = '456';
    }

}

 

 

 

 

 

  • May 12, 2011
  • Like
  • 0

it seems when i mark a component as global in a managed package, i have to mark the component controller,all methods and all properties global,then,it works fine.

that's a little wierd.

 

i hope i can use the component in another managed pacakge,but i want to keep some methods private,since it's hard to refacter if all methods are global.

 

what should i do?

 

 

 

 

  • May 06, 2011
  • Like
  • 0

when i use actionfunction and actionstatus in component, and then put two components in a page,it seems the actionfunction and actionstatus works strangely.

 

it seems component A calls actionfunction in component B.maybe there is a confliction and one of them doesn't work.

 

anyone met this problem,is there a workaround?

  • May 05, 2011
  • Like
  • 0

what is the max depth? i tried 2,it's OK

 

eg:

<apex:repeat>

    <apex:repeat>

    ...

    </apex:repeat>

</apex:repeat>

  • April 21, 2011
  • Like
  • 0

it seems when i mark a component as global in a managed package, i have to mark the component controller,all methods and all properties global,then,it works fine.

that's a little wierd.

 

i hope i can use the component in another managed pacakge,but i want to keep some methods private,since it's hard to refacter if all methods are global.

 

what should i do?

 

 

 

 

  • May 06, 2011
  • Like
  • 0

when i use actionfunction and actionstatus in component, and then put two components in a page,it seems the actionfunction and actionstatus works strangely.

 

it seems component A calls actionfunction in component B.maybe there is a confliction and one of them doesn't work.

 

anyone met this problem,is there a workaround?

  • May 05, 2011
  • Like
  • 0

Hi All,

Firstly, thanks for taking the time to read my post.

I have a vg page that has an actionFunction that calls an apex method from my custom controller. After running, there are a few components that are supposed to reload. However, what's happening is as follows:

1. The page starts to reload.

2. The apex method is called.

3. The components are NOT rerendered.

Does anyone have any ideas as to why that would happen?

Here is the relevant code:

1. ActionFunction tag:

  <apex:actionFunction name="undoEdit" action="{!undoEdit}" rerender="taskInfoDisplay, descInfo,fundraisingInfo, sysInfo,editButtons">
  <apex:param name="fieldToRollBack" value="{!fieldToRollBack}"/>
  </apex:actionFunction>

 

 

2. VF code that calls it:

 

<apex:commandButton image="xxx" onclick="undoEdit('Priority')" rendered="{!editState['Priority']}"/>

 

 

3. Apex Method:

 

public void undoEdit(){
		fieldToRollBack = ApexPages.currentPage().getParameters().get('fieldToRollBack');
		System.debug('the field is:' +  fieldToRollBack );
		//first check if this was edited
		if(editState.get(fieldToRollBack)){
			System.debug('the field was changed');
			if(origTaskVals.containsKey(fieldToRollBack)){
				System.debug('this is a task field, rolling back. The current val: ' + myTask.get(fieldToRollBack) + '. The orig val: ' + origTaskVals.get(fieldToRollBack));
				myTask.put(fieldToRollBack,origTaskVals.get(fieldToRollBack));
				System.debug('after putting, the val is: ' + myTask.get(fieldToRollBack))	;
			}
			
			editState.put(fieldToRollBack, false);
			
		}
	
	}

 

Thanks in advance for your help!

 

  • March 28, 2011
  • Like
  • 0