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
Jhon68Jhon68 

Urgent: button is invoking only one time???

<apex:page StandardController="Activitie__c" StandardStylesheets="true" extensions="ActvityController"  >
 <apex:form >
  <apex:pageBlock >
   <apex:pageblockSection title="Activity" columns="4">
    <apex:pageBlocktable value="{!Activitie__c}" var="some">
     <apex:column headerValue="Step" >
      <apex:inputField value="{!Activitie__c.name}"/>
     </apex:column>
     <apex:column headerValue="Status" >
      <apex:inputField value="{!Activitie__c.Status__c}"/>
     </apex:column>
     <apex:column headerValue="Step" >
      <apex:inputField value="{!Activitie__c.Planned_Start_DateTime__c}"/>
     </apex:column>
     <apex:column headerValue="Planned End Time">
      <apex:inputField value="{!Activitie__c.Planned_End_Date_Time__c}"/>
     </apex:column>
     <apex:column headerValue="Billable">
      <apex:inputField value="{!Activitie__c.Billable__c}"/>
     </apex:column>
     <apex:column headerValue="Priority" >
      <apex:inputField value="{!Activitie__c.Priority__c}"/>
     </apex:column>
   </apex:pageBlockTable>
  </apex:pageblockSection>
  </apex:pageBlock>
  <apex:pageblock >
  <apex:pageBlockSection title="Technician Assignment" id="activitypage" >
  <apex:inputfield value="{!Activitie__c.Provider_Group__c}"/>
  </apex:pageBlockSection>
     <!--<apex:pageBlockSection id="start" >
    <apex:pageblockTable value="{!Activitie__c}" var="no">
    <apex:column headerValue="Provider Group Name" >
 <apex:inputfield value="{!Activitie__c.Provider_Group__c}"/>
    </apex:column>
    <apex:column headerValue="Technician Name" >
    <apex:inputfield value="{!Activitie__c.Lead_Technician__c}"/>
    </apex:column>
  </apex:pageblockTable>
  </apex:pageblockSection>-->
 
   <apex:pageBlockSection title="Technicain" >
  <apex:outputPanel id="bb">
 
<apex:repeat value="{!wraplist}" var="w1" >
 <apex:pageblockTable value="{!}" var="sn">
  <apex:column headerValue="Provider Grop Name">
<apex:inputField value="{!w1.ProviderGroup.Technician_Equipment__c}"/>
</apex:column>
<apex:column headerValue="Lead Technician">
<apex:inputField value="{!w1.ProviderGroup.Technician_Equipment__c}"/>
 </apex:column>
  </apex:pageblockTable>
</apex:repeat>
</apex:outputPanel>
</apex:pageBlockSection>
<apex:commandButton value="AddTechnician" action="{!sortthelist}" reRender="bb">

   </apex:commandButton>
      </apex:pageblock>
      <apex:outputtext id="abc" value="{!button}">value is{!button}</apex:outputtext>
      
      </apex:form>
  <!-- End Default Content REMOVE THIS -->
</apex:page>





public class ActvityController {
private Activitie__c activity {set; get;}
public list<wrap> wraplist{get; set;}
public integer button{set;get;}
public class wrap{
public Provider_Group__c ProviderGroup;
 public Provider_Group__c getProviderGroup()
  {
ProviderGroup = new Provider_Group__c();
return providerGroup;
  }
 }
 public void sortthelist()
  {
   button=1;
 wraplist=new list<wrap> ();
  for(integer i=0;i<button;i++)
  {
 
  wrap  w=new wrap();
  wraplist.add(w);
   //button--;
}
//button++;
//button=wraplist.size();
 }
 
    public ActvityController(ApexPages.StandardController controller) {
  activity=(Activitie__c) controller.getRecord();

    }
 
}

 

 Hi All

when i click the AddTechnicain command first time it is execteing  but when i click second time the method sortthelist is not excecting.

How to invoke the sortthelist method by click the AddTechnician button each and every time.

Any help is Appreciate.

bob_buzzardbob_buzzard

You may be hitting an error here, but as you are only rerending the bb outputpanel its being swallowed.

 

Try adding a pagemessages component:

 

<apex:pageMessages id="msgs" />

 

and tweak your button as follows:

 

<apex:commandButton value="AddTechnician" action="{!sortthelist}" reRender="bb, msgs">

 

Does that show any error messages?

 

Jhon68Jhon68

Hi BOb,

No error,

it is executing First time why it is not executing when I click 2nd time Actually the Control is not going to sorthlist method.

Would you please send the code how can we add the entire row  dynamically  when I click command button??? 

bob_buzzardbob_buzzard

What are you expecting it to do the second time around - as far as I can tell it creates a list with a single element each time, thus I'd expect the page to look the same no matter how many times the button was clicked.