You need to sign in to do that
Don't have an account?
Slava Ram
links became dead after page rerendering
Hello everybody!
Here my example:
public class DemoController {
public List<User> mRecords { get; set; }
private Integer mRecordsCount { get; set; }
public ADemoController() {
mRecordsCount = 1;
mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}
public void loadOneMoreRecord() {
mRecords.clear();
mRecordsCount++;
mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}
}
<apex:page controller="DemoController" >
<apex:pageMessages />
<apex:form id="TheForm">
<apex:pageBlock id="TheBlok">
<apex:commandButton value="Load one more record" action="{!loadOneMoreRecord}" reRender="TheTable" />
<apex:pageBlockTable value="{!mRecords}" var="record" id="TheTable">
<apex:column headerValue="Records">
<apex:outputLink value="/{!record.Id}"><apex:outputText value="{!record.FirstName}" /></apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
After first page loading the link is work fine, but after loading more records in table, links became dead (works only through rmc).
The question is how can I prevent this?
Sorry for my english.
Here my example:
public class DemoController {
public List<User> mRecords { get; set; }
private Integer mRecordsCount { get; set; }
public ADemoController() {
mRecordsCount = 1;
mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}
public void loadOneMoreRecord() {
mRecords.clear();
mRecordsCount++;
mRecords = [SELECT Id, FirstName FROM User LIMIT :mRecordsCount];
}
}
<apex:page controller="DemoController" >
<apex:pageMessages />
<apex:form id="TheForm">
<apex:pageBlock id="TheBlok">
<apex:commandButton value="Load one more record" action="{!loadOneMoreRecord}" reRender="TheTable" />
<apex:pageBlockTable value="{!mRecords}" var="record" id="TheTable">
<apex:column headerValue="Records">
<apex:outputLink value="/{!record.Id}"><apex:outputText value="{!record.FirstName}" /></apex:outputLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
After first page loading the link is work fine, but after loading more records in table, links became dead (works only through rmc).
The question is how can I prevent this?
Sorry for my english.
Use below code and let me know.
Ihave added target attribute if u want open in same page use above one , else for new tab use target="_blank"
All Answers
My guess is you're pulling your clicking on a link for an inactive user, which would appear "dead".
Try filtering out the inactive users in your query, e.g:
Use below code and let me know.
Ihave added target attribute if u want open in same page use above one , else for new tab use target="_blank"
Ola Ashi! It works! Thanks so much!