You need to sign in to do that
Don't have an account?
need help to write a custom controller to display data in VF pageblock table
Hi,
i am new to apex , please help me
here is my VF code:
<apex:page controller="titlesalary">
<apex:form >
<apex:sectionHeader title="designation"/>
<apex:pageBlock >
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!save}" value="submit"/>
</apex:pageBlockButtons>
title<apex:selectlist value="{!title}" size="1">
<apex:selectOption itemValue="none" itemLabel="--None--"/>
<apex:selectOption itemValue="developer" itemLabel="developer"/>
<apex:selectOption itemValue="sr.developer" itemLabel="sr.developer"/>
<apex:selectOption itemValue="admin" itemLabel="admin"/>
</apex:selectList>
year<apex:selectlist value="{!year}" size="1">
<apex:selectOption itemValue="none" itemLabel="--None--"/>
<apex:selectOption itemValue="2009" itemLabel="2009"/>
<apex:selectOption itemValue="2010" itemLabel="2010"/>
<apex:selectOption itemValue="2011" itemLabel="2011"/>
</apex:selectList>
department<apex:selectList value="{!department}" size="1">
<apex:selectOption itemValue="none" itemLabel="--None--"/>
<apex:selectOption itemValue="it" itemLabel="IT"/>
<apex:selectOption itemValue="engg" itemLabel="ENGG"/>
<apex:selectOption itemValue="service" itemLabel="SERVICE"/>
</apex:selectList>
<apex:pageBlockTable value="{!salary}" var="hi" columns="4">
<apex:column headervalue="title" value="{!title}"/>
<apex:column headervalue="year" value="{!year}"/>
<apex:column headervalue="department" value="{!department}"/>
<apex:column headervalue="salary" value="{!salary}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I am using custom controller.my task is to display yearly salary according to job title in VF PAGE BLOCK table.
I reckon you'll need a controller something like:
There are three properties backing your select list and I've assumed the save button executes the search.
Note that this won't handle if the user selects 'none' - the where clause would need to be built dynamically to include/exclude the selected options.
All Answers
So have you had a stab at the controller and had problems or are you starting from scratch?
Hi Bob,
I am starting from scratch.
please guide me.
thanks
You'll need to tell us a little more about the sobjects that are backing the page. For example, are the properties that are backing the selectlist from an sobject or are they at the controller level?
i think its controller level, i inserted data from custom object and now i want to display yearly/department salary in pageblock table
I reckon you'll need a controller something like:
There are three properties backing your select list and I've assumed the save button executes the search.
Note that this won't handle if the user selects 'none' - the where clause would need to be built dynamically to include/exclude the selected options.
Thanks Bob,it works perfect