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
IcaroIcaro 

Send param iterator from Visualforce to Controller

Hello guys !!! 

I'm having a problem with dynamics columns and table !! I would like to pass param to controller each time that I have a new line on the table.

This is the line to send the value: apex:param name="name" value="{!func.name}" id="name"/>

But when arrive in the method, the value of "name" is null. Look the code below !!


/* VISUALFORCE */
apex:pageBlockTable value="{!listFuncionario}" var="func"> //LINE

       apex:column headerValue="Funcionario">
              apex:outputField value="{!func.name}"/>
       /apex:column>

       apex:param name="name" value="{!func.name}" id="name"/>

       apex:repeat value="{!ApoioStaff}" var="eachDay">
              apex:column headerValue="{!eachDay.Diad__c}" >
                     apex:inputField value="{!eachDay.Diad__c}" />
              /apex:column>
        /apex:repeat>
/apex:pageBlockTable>


/* APEX */


public List<Dia__c> getApoioStaff(){

       this.name = ApexPages.CurrentPage().getparameters().get('name');

       List<Dia__c> days;
       days = [select id, name, Diad__c, FuncionarioPai__r.name from Dia__c where FuncionarioPai__r.name = :this.name];
       return days;
}


Does someone have some idea to solve my problem ?!?!

Thank you so much community !!

AdrianCCAdrianCC

Hi,

 

What exactly are you trying to accomplish? 

apex:param can only be the child of certain elements: http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_param.htm

And apex:pageBlockTable is not among them.

 

Check this out: http://flexandsalesforce.blogspot.ro/2011/07/adding-rows-dynamically-to-page-block.html

Is this what you want?

 

Thanks,

Adrian

IcaroIcaro

Hi Adrian,

 

Thank you so much for answered me !!

Unfortunately these links didn't help me. I will explain my sittuation !!

I have a list of "Funcionario" and each of them have list of "Day".

In this line apex:pageBlockTable value="{!listFuncionario}" var="func" I'm iterate the list of "Funcionario". This is to each line.


To each column a need to show in the input field with value of each day of THAT "Funcionario".

DAY            1      2    3    4   5 ...

Func 1       20           9   14 7
Func 2        4     3    68       1
...


The line need to be dynamic because I can add more "Funcionario". It's a object.
The column need to be dynamic because to each page CRO have different quantities of DAY.

The struct is this.

CRO(father object)
  |-Funcionario
      |- Day

One CRO can have many "Funcionario". But in this CRO the quantity of DAY is the same to all "Funcionario".

- CRO-1 have 10 days
   |- Func 1    10 days
   |- Func 2    10 days

- CRO-2 have 23 days
   |- Func 5    23 days
   |- Func 6    23 days

Did you understand me ?

This is my problem and I really don't know how to solve it !!!


Thank you Adrian !!