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
NervosaNervosa 

Change PageBlockTable's "value" attribute from custom controller

Greetings to everyone!

 

Strictly speaking - my question is in subject. I have a PageBlockTable on a VF page:

 

<apex:pageBlockTable value="{!items}" var="i" id="ListOfItems" >

 Is it possible to change its "value" attribute to another one by clicking a button:

 

 <apex:commandButton value="Search" action="{!search}" rerender="resultsBlock" status="status"/>

 Thanks in advance.

logontokartiklogontokartik

Hello Nervosa,

 

I am not sure if you can do that with <apex:pageBlockTable>, the formula field that you set as value is getting its values from a Controller. If you want to change something, i would suggest you make it in controller

Raj.ax1558Raj.ax1558

Yes it is possible via a Label.

 

<apex:commandbutton value="{!$Label.labelname}" action="{!methodname} />

 

Change this Label value in apex using this code -  

System.Label.Label_name

 

 

Thank you.

 

Please mark this as solution for others to get it easily. 

 

 

NervosaNervosa

Okay. I did it like this:

    <apex:pageBlockTable value="{!$Label.itemsrc}" var="i" id="ListOfItems" >

 and in my controller:

   public fullfunctionality_2() {
       System.Label.itemsrc='items';
       ViewData();
   }

 But i get an error:

Error: Fullfunctionality_2 Compile Error: Invalid external string name: itemsrc at line 17 column 8	

 What do I do wrong?

NervosaNervosa

I've found my mistake - i didn't create label in my Setup->Create->Custom Labels =)

 

Well, I did it.

But still there is a mistake

 

Error: Fullfunctionality_2 Compile Error: Expression cannot be assigned at line 17 column 8