+ Start a Discussion
ForceDev79ForceDev79 

Align LEFT & RIGHT VALUES IN DATA TABLE COLUMN BY CLICKING BUTTON

HI FRIENDS,

 

     i have one requirement ,that is

 

 Scenario:  I have VF page,on that i have two buttons  RIGHT,LEFT. and  Datatable having two columns like

 

                                    [ RIGHT],[ LEFT]   

 

                                        CHECKBOX                NAME

                                                 []                           AccountName

 

after checcked the checkbox,if u click right  NAME value moved to right,i u click LEFT,then Name moved to left

 

can u any body help me

 

ThanX

RamboRambo

Try this...

 

have two diff pageblock sections and render it on a certain value(for ex : a boolean value which is der in de controller)

 

in the controller have two diff methods for right and left buttom clicks.

Right sets the boolean value to false and left sets the boolean value to true and render the two pageblock sections.

 

<apex:page standardController="Account" tabStyle="account" extensions="thai">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <apex:commandButton value="Right" action="{!getright}"/>
                <apex:commandButton value="Left" action="{!getleft}"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection id="right" rendered="{!IF(tri=false, true, false)}">
            <apex:dataTable value="{!account}" var="a">
            <apex:column >
            <apex:inputCheckbox value="{!a.hai__c}"/>
            </apex:column>
            <apex:column >
            <apex:facet name="header">Name</apex:facet>
            {!a.name}
            </apex:column>
            </apex:dataTable>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection id="left" rendered="{!IF(tri=true, true, false)}">
            <apex:dataTable value="{!account}" var="a">
             <apex:column >
            <apex:facet name="header">Name</apex:facet>
            {!a.name}
            </apex:column>
            <apex:column >
            <apex:inputCheckbox value="{!a.hai__c}"/>
            </apex:column>
            </apex:dataTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

 

Extension:

 

public class thai{

      public thai(ApexPages.StandardController controller) {

    }


Boolean tri = false;

public Boolean gettri(){
return tri;
}

public void getleft(){
tri = true;
}
public void getright(){
tri = false;
}

Hari@RockzsHari@Rockzs

Thank u Rambo,

 

iam getting error  at

 

"{!a.hai__c}"   

 

can u clarify about this rambo

 

 

Thank u

 

Hari@Rockz

Hari@RockzsHari@Rockzs

Rambo,

 

only the account name moved to right side in the column itself,when u click the account name (u have checked only) moved to left in the column it self not all names.....

 

can u give any suggestions

 

 

Thank u 

Hari@Rockz

RamboRambo

Hi dude,

 

                      Could u just elaborate on wat exactly is de requirement ur looking for???

Hari@RockzsHari@Rockzs

just the values in data table column(only selected Names only) Moved to Right side in the datatable column itself when u click on right and when u click on left only selected values moves to left in the column it self.

 

 

thank u