You need to sign in to do that
Don't have an account?
inner data table values not saved.
Hi All,
in the following code not geting the inner data table values entered in vf page.(also getting null values)
controller
-------------
public with sharing class testcontroller {
public testcontrolelr(){
}
public class MainSkudata{
public integer orderid{get;set;}
public boolean allocation{get;set;}
public string allocationid{get;set;}
public string conditionallocation{get;set;}
public string conditionsku{get;set;}
public list<SubMainSkudata> sublist{set;get;}
}
public class SubMainSkudata{
public string ledgernumber{get;set;}
public string ledgername{get;set;}
public string percentageamount{get;set;}
public string suballocationid{get;set;}
public string recordtypeid{set;get;}
}
public List<SelectOption> getshowConditionsallocation(){
List<SelectOption> allocationskuconditions= new List<SelectOption>();
allocationskuconditions.add(new selectOption('IS','SKU Is'));
allocationskuconditions.add(new selectOption('Starts With','SKU Starts With'));
allocationskuconditions.add(new selectOption('Ends With','SKU Ends With'));
allocationskuconditions.add(new selectOption('Includes','SKU Includes'));
allocationskuconditions.add(new selectOption('Is Recurring','Is Recurring'));
allocationskuconditions.add(new selectOption('any SKU','Any SKU'));
return allocationskuconditions;
}
public Integer submaprowid{get;set;}
public void addsubAllocation(){
List<SubMainSkudata> sal = new List<SubMainSkudata>();
sal.add(new SubMainSkudata());
system.debug('value'+submaprowid);
MainSkudata m = FieldValueslistAllocations.get(integer.valueOf(submaprowid));
system.debug('valuesssss'+m);
m.sublist.add(new SubMainSkudata());
FieldValueslistAllocations.set(submaprowid,m);
}
public List<MainSkudata> FieldValueslistAllocations;
public void setFieldValueslistAllocations(List<MainSkudata> items){ FieldValueslistAllocations= items; }
public List<MainSkudata> getFieldValueslistAllocations(){
if(FieldValueslistAllocations==null){
FieldValueslistAllocations = new list<MainSkudata>();
List<SubMainSkudata> sublistdat = new List<SubMainSkudata>();
sublistdat.add(new SubMainSkudata());
MainSkudata m = new MainSkudata();
m.sublist = sublistdat;
FieldValueslistAllocations.add(m);
}
return FieldValueslistAllocations;
}
public void saveskuallcation(){
system.debug('testvaluessssss'+FieldValueslistAllocations);
}
}
vf page
---------
<apex:page controller="testcontroler">
<apex:form >
<apex:pageblock title="Allocations">
<apex:pageBlockSection title="SKU Allocation" columns="1">
<apex:outputPanel id="RefreshBlockledger_1">
<apex:variable value="0" var="rowNumledger"/>
<apex:dataTable columns="8" value="{!FieldValueslistAllocations}" var="item" cellspacing="-10px" style="margin-left:40px;margin-top:10px;" >
<apex:column >
<apex:inputhidden value="{!item.allocation}" />
</apex:column>
<apex:column >
<apex:outputLabel value="If "/>
</apex:column>
<apex:column headerValue="Condition">
<apex:selectlist value="{!item.conditionallocation}" size="1" styleclass="conditionsallocation{!rowNumledger}">
<apex:selectOptions value="{!showConditionsallocation}" />
</apex:selectlist>
</apex:column>
<apex:column headerValue="SKU " >
<apex:inputText value="{!item.conditionsku}" style="width:150px;" styleClass="conditionsku{!rowNumledger}" maxlength="10"/>
</apex:column>
<apex:column breakBefore="true" colspan="8" rendered="{!IF(VALUE(rowNumledger) < FieldValueslistAllocations.size && VALUE(rowNumledger) != FieldValueslistAllocations.size,true,false)}">
<apex:variable value="0" var="rowNumSubAllocation" />
<apex:datatable columns="8" value="{!item.sublist}" var="suballocation" cellspacing="-10px" style="margin-left:40px;margin-top:10px;">
<apex:column headerValue="Account Number">
<apex:inputText value="{!suballocation.ledgernumber}"/>
</apex:column>
<apex:column headerValue="Account Name">
<apex:inputText value="{!suballocation.ledgername}"/>
</apex:column>
<apex:column headerValue="Amount">
<apex:inputText value="{!suballocation.percentageamount}"/>
</apex:column>
<apex:column >
<apex:variable var="rowNumSubAllocation" value="{!VALUE(rowNumSubAllocation) + 1}"/>
</apex:column>
</apex:datatable>
<apex:commandButton action="{!addsubAllocation}" value="Add New" style="margin-top:20px;" reRender="RefreshBlockledger_1">
<apex:param name="" value="{!rowNumledger}" assignTo="{!submaprowid}"/>
</apex:commandbutton>
<apex:variable var="rowNumledger" value="{!VALUE(rowNumledger)+1}"/>
</apex:column>
</apex:datatable>
<apex:commandButton value="Save" action="{!saveskuallcation}" reRender="RefreshBlockledger_1"/>
</apex:outputPanel>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Any one can u please help me that issue.
Thanks in advance.....