function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sushma_RaoSushma_Rao 

Rerender the column in page block table.

Hi all,

 

I have a page block table whilch has two columns one with the data nad the other with two buttons to move the records up and down.

I am not able to rerender the column on the change.

The code is as below:

 

<apex:page controller="TabOrderCustomSetting" id="page1">

    <apex:form >
    <apex:pageBlock title="Tab Order in Job Details" id="pb">
            
            <apex:pageblockTable value="{!objlist}" var="v" style="width:700px" id="Pgb" >
               
                <apex:column id="col1"> <apex:actionregion id="ar" >   <apex:outputPanel value="{!v.Name}" style="width:20px"/>&nbsp;&nbsp;  <apex:outputText value="{!v.Order__c}" style="width:20px"/>&nbsp;&nbsp; </apex:outputPanel > </apex:column>  
            
                <apex:column >
                <apex:commandButton value="Up"  title="Move Up" action="{!MoveUp}" reRender="ar" >   <apex:param name="strTabID" value="{!v.id}" assignTo="{!tabid}"/> </apex:commandButton>
                      &nbsp;
                        <apex:commandButton value="Down"  title="Move Down" action="{!MoveDown}"  reRender="ar"> <apex:param name="strTabID"  value="{!v.id}" assignTo="{!tabid}"/></apex:commandButton>
                 </apex:column>
                
            </apex:pageblockTable>            
        </apex:pageBlock>
      
    </apex:form>  
</apex:page>

 

 

Please can someone suggest how can I achive this.

Please help.

 

Thanks in advance.

Regards,

Sushma

 

Shailesh DeshpandeShailesh Deshpande
HI,

I dont think you'd be able to achieve that. You should try rerendering the entire pageblock instead.
Sushma_RaoSushma_Rao

Hi,

 

Thanks for replying.

 

We have tried by different ways, used page block table, page block, output panel, action region.

This is one of the sample which we tried out.

 

 

<apex:actionFunction action="{!MoveUp}" name="moveup1" reRender="pb" >
          <apex:param name="strTabID" value="" assignTo="{!tabid}"/>
    </apex:actionFunction>
     
    <apex:actionFunction action="{!MoveDown}" name="movedown1" reRender="pb">
        <apex:param name="strTabID" value="" assignTo="{!tabid}"/>
    </apex:actionFunction>
     
        <apex:pageBlock title="Tab Order in Job Details" id="pb">
          
                     <apex:pageblockTable value="{!objlist1}" var="v" style="width:700px" id="Pgb"  >
                        
                        <apex:column >
                            <apex:outputText value="{!v.Name}"/>
                        </apex:column>
                        
                        <apex:column >
                            <apex:outputText value="{!v.Order__c}" style="width:20px"/>
                        </apex:column>
                         
                        <apex:column >
                        
                            <apex:commandButton value="Up"  title="Move Up" onclick="moveup('{!v.Id}')" ></apex:commandButton> &nbsp;
                            <apex:commandButton value="Down"  title="Move Down" onclick="movedown('{!v.Id}')"></apex:commandButton>  
                         
                        </apex:column>    
                     </apex:pageblockTable>  
           
        </apex:pageBlock>

 

Is this possible by some other manner? Or should we think of some other way of implementing this?

Please help,

Thanks in advance.

 

 

Shailesh DeshpandeShailesh Deshpande
I think the way you implemented earlier was fine. You only need to rerender pageblock instead of column. I.e replace rerender = "ar" with rerender = ""pb"
Sushma_RaoSushma_Rao

Hi,

 

Thanks for the reply,

My problem was solved but I have a question,

public TabOrderCustomSetting()
    {
       // objlist1 = [select Name, Order__c from csr__JobDetails__c ORDER By Order__c];
        strQuery();              
    }
 public pageReference strQuery(){
        
        objlist1 = [select Name, Order__c from csr__JobDetails__c ORDER By Order__c];
        return null;
        }
 public PageReference MoveUp() {
 update objListUpdate;
        strQuery();            
        return null;
        }

 Why do I have to call the strQuery(); method in the button, does rerender not handle getting the updated values?

 

 

 

 

Shailesh DeshpandeShailesh Deshpande
HI,

In your case it wouldn't. But I believe if your had used a getter method for the list it would have worked. For eg. If you had a method named, getObjList1() in your class, then rerender would have made a call to this method. But however in this method, you would still have to either call strQuery() method or wirte the query itself and return the list.

So in your code, you need to rename the strQuery() method to getObjList1(), and in your move up/move down method remove the call for strQuery() method. Also change the return type of the method to List<csr__jobdetails__c> and return objList1. This should work.

I hope this answers your question.