• Rolland
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi, I need to deal with the selected records from enhancedlist view. In my custom controller, I always get "c2=0" by using controller.getSelected() whenever I make the selection in the listview and then click the "get seleted" link.   What is the event for the selection?

 

And getRecords() can not return more than 20 that is not useful for the project.

 

And getRecords() can not get refresh when I select another view in the view option dropdown list.



I really appraciate if anybody has a idea! 

 

My test page:

<apex:page standardController="ProfileHierarchy__c" recordSetvar="profiles" extensions="testController">

<apex:enhancedlist type="ProfileHierarchy__c" height="200" rerender="c1,c2" />

<apex:outputText id="c1" value="c1={!c1}" /> <br>
<apex:outputText id="c2" value="c2={!c2}" /> <br>
<apex:form >
<apex:commandLink action="{!setC2}" value="get selected" reRender="c2" />
</apex:form>
</apex:page>

my controller:

 public class testController {

public testController (ApexPages.StandardSetController controller)
{
 li=controller;
}

public ApexPages.StandardSetController li{get;set;}

 

public Integer getC1(){
return ((List<ProfileHierarchy__c>)li.getRecords()).size();
}


public Integer c2=0;
public Integer getC2(){
 return c2;
}
public void setC2(){
 c2 = ((List<ProfileHierarchy__c>)li.getSelected()).size()+1;
}

}

Hi,

In our application, the user must access the internal news / message.
As a simple test, I use <apex:param name="a"  value="news1,content"  assignTo="{!content}"/>  within <apex:commandLink>.  The problem is, the variable "content" can only get the value"news1".  In other word, if the string value contains a comma "," , all contents after comma will be ignored.  How to deal with it ?   Actually, the message is a long string including many commas and line breaks.  How can I get the whole content by using <apex:param name="a" value="{!each.Message__c} assignTo="{!content}"/>  and display it in a right way (including line breaks) ?

 

Thank you very much!

 

The test code:

<apex:page controller="testmsg">
 <apex:outputtext value="{!content}" style="color:red"/>
<br/>
<apex:form >
  <apex:commandlink action="{!dosomething}" value="test message box">
    <apex:param name="a" value="news1,content" assignTo="{!content}"/> 
  </apex:commandlink>
</apex:form>
</apex:page>

public class testmsg{

public string content{get;set;}
public void dosomething(){
//
}
}