+ Start a Discussion
bujjibujji 

Regarding PageBlock table and Repeat

Hi,

 

I am using pageBlockTable to display some values and it is working fine. After that for look and feel i am using Repeat tag and i am calling same method to display the values but it is not working.

 

Is there any difference between PageBlockTable and Repeat. Please clarify me.

 

Thanks,

Bujji

Shiv ShankarShiv Shankar

Hi bujji,

 

Can you put the code please. might be you are putting <apex:repeat> outside <td> element, just put it outside <tr>.

<table>
	<apex:repeat value="{! list}" var="rec">
	<tr>
		<td>{! rec.1Field__c}</td>
		<td>{! rec.2Field__c}</td>
		<td>{! rec.3Field__c}</td>
	</tr>
	</apex:repeat>
</table>

 

 

Thanks.

bujjibujji
Thanks, for the reply. I tried that one also but no change.
Below is the code which is working fine for pagebloctable but not repeat.
I have check the debug log for <apex:repeat> , no results are not coming.

<apex:pageBlock title="Account Details">
<apex:pageBlockButtons >
<apex:commandButton value="SAVE" action="{!update1}" reRender="Results"/>
</apex:pageBlockButtons>

<table >
<!--
<apex:repeat value="{!newm}" var="o" id="Results">
<tr><td>&nbsp;</td></tr>
<tr>
<td width="11%" align="left" style="font-size:12px;font-weight:bold;">Account Name&nbsp;</td>
<td width="30%" align="left">
<apex:outputField value="{!o.Name}"> </apex:outputField>
</td>
</tr>
</apex:repeat>
-->

<apex:pageBlockTable value="{!newm}" var="o" id="Results" >

<apex:column headerValue="Phone" >
<apex:inputField value="{!o.Phone}" ></apex:inputField>
</apex:column>
<apex:column headerValue="Name" >
<apex:inputField value="{!o.Name}"></apex:inputField>
</apex:column>
</apex:pageBlockTable>
</table>
</apex:pageBlock>


funtion is
public list<Account> getNewm()
{
List<Account> con_dis = [select id,Name,phone from Account where id=:s];
return con_dis ;
}

Thanks,
Bujji
Shiv ShankarShiv Shankar

Hi bujji,

 

i checked the code but it's look fine. I have just made some small changes , can you check it once.

<table >
		<tr>
			<td></td>
			<td></td>
		</tr>
		<apex:repeat value="{!newm}" var="o" id="Results">
			<tr>
				<td width="11%" align="left" style="font-size:12px;font-weight:bold;">
					Account Name&nbsp;
				</td>
				<td width="30%" align="left">
					<apex:outputField value="{!o.Name}"> </apex:outputField>
				</td>
			</tr>
		</apex:repeat>
</table>

 

bujjibujji
yeah i tried, sorry it didn;t workout for me. I am aligning by modfing Salesforce stylesheet.

Thanks, for the help.

Thanks,
Bujji
bujjibujji
Hi siva, small suggestion. I am updating the data and i want to display some popup or text message in vf page on successful updation.

Is there any way to do it.

Thanks,
Bujji
Shiv ShankarShiv Shankar

Hi bujji,

 

From my point of view we can have a bloack level elemnt like <apex:outputpanel> in this we can write a javaScript.

after calling the action method of controller we will reRender this element.

 

VF page

<apex:outputPanle id="updateMessage">
	<script>
		if({! updateSuccessfully} == true){
			alert('Your Data Successfully Updated');
		}
	</script>
<apex:outputPanle>

 Controller

In controller we have one Boolean variable 
public class controllerclass{
	public Boolean updateSuccessfully = false;
	
	
	//action method to upload data
	public void uploadData(){
		..
		..
		Set of Instructions
		..
		..
		updateSuccessfully = true;
	}
}

 after calling upladData method we will reRender 'updateMessage' .

Might be this can help you for some extent.

thanks.