You need to sign in to do that
Don't have an account?
How to add dyanavic column during runtime??
Hi there!
I have a entry form containing
customer Name lookup relationship
item name lookup relationship
month combo having month frm jan to dec
forecast qty text field
i made some entries and then created UI page with following code:
<apex:page standardController="Forecast_Entry__c" extensions="ForecastEntryExtension" > <h1>Sales Forecast</h1> <apex:pageBlock > <apex:pageBlockSection title="Forecast Records"> <apex:dataTable value="{!ForecastRecords}" var="fc" styleClass="list"> <apex:column > <apex:facet name="header">Customer Name</apex:facet> <apex:outputField value="{!fc.Customer_Name__c}"/> </apex:column> <apex:column > <apex:facet name="header">Item Name</apex:facet> <apex:outputField value="{!fc.Item_Name__c}"/> </apex:column> <apex:column > <apex:facet name="header">Month1</apex:facet> <apex:outputText value="{!fc.Forecast_Qty__c}" rendered="{!fc.Month__c='Month1'}" style="font-weight:bold;color:red " /> </apex:column> <apex:column > <apex:facet name="header">Month2</apex:facet> <apex:outputText value="{!fc.Forecast_Qty__c}" rendered="{!fc.Month__c='Month2'}" style="font-weight:bold;color:green " /> </apex:column> <apex:column > <apex:facet name="header">Month3</apex:facet> <apex:outputText value="{!fc.Forecast_Qty__c}" rendered="{!fc.Month__c='Month3'}" style="font-weight:bold;color:blue " /> </apex:column> </apex:datatable> </apex:pageBlockSection> </apex:pageBlock> <apex:detail ></apex:detail> <apex:detail subject="{!Forecast_Entry__c.Customer_Name__c}" relatedList="false" /> </apex:page>
I want the column header should be dynamic and automatically set as per distinct month available in table data during page display. In my code it is code dependent for month1 to month3. but sometime data can be for month1 to month2 ,sometime month1 to month4 and so on.... i want this part should be dynamic not pre-coded.
All is to add column,its header and value dynamically.....Please help in terms of code.
Any help will be heartly welcomed.
Thanks,
Jha
My extension code is below , please let me know where i need to do changes in terms of code,as im new to salesforce.Im struggling hard to get this solved.please help.....
public with sharing class ForecastEntryExtension { private final Forecast_entry__c forecastentryObj; public ForecastEntryExtension(ApexPages.StandardController controller) { this.forecastentryObj = (forecast_entry__c)controller.getrecord(); } public forecast_entry__c[] getForecastRecords() { /* forecastentryList =[SELECT a.Customer_name__c,a.item_name__c,a.month__c,a.forecast_qty__c, b.Customer_name__c,c.Item_name__c FROM forecast_entry__c a,customer_entry__c b, item_entry__c where a.Customer_name__c= b.Customer_name__c and a.item_name__c=c.Item_name__c ]; */ Forecast_entry__c[] forecastentryList =[SELECT a.Customer_name__c,a.item_name__c, a.month__c,a.forecast_qty__c,a.contact__c FROM forecast_entry__c a]; return forecastentryList; } }
Thanks,
Jha
Lets assume that you don't want to show column 'X' based on a certain condition 'Y' So you define a boolean variable doNotRenderX in your controller. In the controller, if your condition Y is met, you set doNotRenderX to true else set to false.
In your page, with the column X, now add the rendered component i.e. rendered='{!doNotRenderX}'. So based on the this value, either the column will be displayed else not.
Hi shah,
Thanks.i have done with my first part.
Now i need a help to create a UI page,requirement is somewhat like
when user open the same page it should have all customername,productname filled already and able to fill the forecast qty below the months for jan,feb,mar........dec.finally click the save button to save all records at once in table having fields
Customername,productname,month,forecastqty with their respective values.
i have designed the page and able to enter the forecast qty also below the months but my problem is this that i cant save all the data at one time..... my page looks like
Customer Product Jan Feb Mar Apr ........................ Dec
abc xyz 100 90 20
abc pqr 30 20
mno xyz 40
Save Cancel
Is there any such control available already by salesforce? if not,how to code to get save all the data at once.
any help will be greatly appreciated... Please help me out....