• Rahul456
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 3
    Replies

Hi every one,

 

I am facing the problem with datatable in visual force with apex.In my application i want to display the table as three fields with coreesponding values.But here i am getting 3 tables.How to make it as single table.

 

Here my code is as follows.

 

VFPage

 

<apex:page standardController="CAF_Charge__c" extensions="popupwindow">
<apex:form >
<apex:dataTable value="{!DesCharge}" var="a" cellPadding="4" border="1" >
<apex:column headervalue="Charge header information">
<apex:commandLink action="{!filltextval1}">
<apex:param name="name1" value="{!a.Charges_Head__c}"/>
{!a.Charges_Head__c}</apex:commandLink></apex:column>
</apex:dataTable>
<apex:dataTable value="{!DesCharge}" var="a" cellPadding="4" border="1" >
<apex:column headervalue="Description of charge">
<apex:commandLink action="{!filltextval1}">
<apex:param name="name1" value="{!a.Description_Of_Charges__c}"/>
{!a.Description_Of_Charges__c}</apex:commandLink></apex:column>
</apex:dataTable>

<apex:dataTable value="{!DesCharge}" var="a" cellPadding="4" border="1">
<apex:column headervalue="Percentage">
<apex:commandLink action="{!filltextval1}">
<apex:param name="name1" value="{!a.Percentage__c}"/>
{!a.Percentage__c}</apex:commandLink></apex:column>
</apex:dataTable>

</apex:form>
</apex:page>

 

Apex Class

 

public class popupwindow
{

    public popupwindow(ApexPages.StandardController controller) {

    }
  

    Public string chargeshead{get;set;}
    Public string doc{get;set;}
    Public string percentage{get;set;}
   

   
    public List<chiranjeevi__CAF_Charge__c> getDesCharge()
    {
     List<chiranjeevi__CAF_Charge__c> descharge=[select chiranjeevi__Charges_Head__c,chiranjeevi__Description_Of_Charges__c,chiranjeevi__Percentage__c  from chiranjeevi__CAF_Charge__c  limit 10];
     return descharge;
    }


    Public void filltextval1()
    {
    chargeshead= apexpages.currentpage().getparameters().get('name1');
    }
   
   
}

 

Thanks,

Manu..

In testmethod I inserted a account with Name field.Its showing the following message

 

System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: <unknown> duplicates value on record with id: <unknown>

 

But I am able to create Account record through tab.

Hi All,

       Plz help me out,why this javascript(colred in red) isn't working.

<apex:page controller="abc" id="UseCaseDisplay">
<apex:form >

<apex:pageBlock  mode="edit" id="thePageBlock">
<apex:pageBlockSection columns="3">
<table width="500px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td  align="left"><input type="radio" name="select" checked="true"  onClick='recentres(1)'/>Country</td>
<td  align="center"><b>OR</b></td>                   
<td  align="left"><input type="radio" name="select" onClick='recentres(2)'/>Other countries</td>
</tr>
</table>  
</apex:pageBlockSection>
</apex:pageBlock>
<br></br>

<div id="selc" style="display:block;">
<apex:pageBlock title="State Selection">

<apex:panelGrid columns="2">
Country &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<apex:selectList value="{!category}" size="1" id="category">
<apex:selectOptions value="{!categories}"/>
<apex:actionSupport event="onchange" rerender="features"/>
</apex:selectList>

<apex:outputLabel value="State" for="features"/>
<apex:selectList value="{!feature}" size="1" id="features" disabled="{!ISNULL(category)}">
<apex:selectOptions value="{!features}"/>
</apex:selectList>
</apex:panelGrid>
</apex:pageBlock>
</div>

<div id="select" style="display:none;">
<apex:pageBlock title="Others Selection" >
Country*
<apex:inputText id="cntries5" value="{!contry}">
</apex:inputText><br></br>
<br></br>
State*<apex:inputText id="state5" value="{!stat}">
</apex:inputText>
</apex:pageBlock>
</div>
<apex:commandButton value="Save Reseller Account" action="{!save}"/>
</apex:form>
 
<script language="JavaScript">
function recentres(rad)
{

if(rad==1)
{

document.getElementById("selc").style.display='block';
document.getElementById("select").style.display='none';
document.getElementById("{!$Component.state5}").value ='';
document.getElementById("{!$Component.cntries5}").value ='';

}
else
{

document.getElementById("selc").style.display='none';
document.getElementById("select").style.display='block';
}

}

</script>
</apex:page>