Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
display object records in visualforce page picklist field values wise
Hi,
Below code sample can display Object records in VFP,
apex:page standardController="account" tabStyle="account" recordSetVar="accounts" sidebar="false"> <apex:pageBlock > <apex:pageblockTable value="{!accounts}" var="a" > <apex:column value="{!a.name}"/> <apex:column value="{!a.AccountNumber}"/> <apex:column value="{!a.NumberOfEmployees}"/> <apex:column value="{!a.Rating}"/> </apex:pageblockTable> </apex:pageBlock> </apex:page>
Here what do you mean by Picklist Fieldvise.
Can you explain clearly what you are looking for?
I think the above code can be used to get what you are looking for
no it'snot
actual for picklist means selectlist in visualforce
selectlist has accountname,account number,phone ,website
like wise we can search
What are you looking for? Implementing search functionality In VFP or what?
if you can able to spend some time in writing Question it will be easy for Board members to answer you.
yah i want to implement search functionality in visualforce
selectlist has accountname,account number,phone ,website,createddate
Yes you can do this Through VFP and APex.
You can use Schema.SobjectType to get the describe information about object, fields and get that into Picklist.
By this you can get all the information regarding the object.
// Declare prop to store the selected value public String selfld{get;set;} // Declare a property variable in calss public List<SelectOption> objFields{get; set;} // create memore for this like below in mehtod objFields =new List<SelectOption>(); // add none if needed in Picklist. objFields.add(new SelectOption('-1','--None--')); write below code Map<String,Schema.SObjectType> ssot = Schema.getGlobalDescribe(); Schema.SObjectType sobjType = ssot.get('objectname__c'); Schema.DescribeSObjectResult dsr = sobjType.getDescribe(); Map<String,Schema.SObjectField> obj = dsr.fields.getMap(); for(String fieldName : obj.keyset()) { Schema.SObjectField field = obj.get(fieldName); Schema.DescribeFieldResult fieldDesc = field.getDescribe(); objFields.add(new SelectOption(fieldName.toLowerCase(),fieldName.toLowerCase())); objFields.sort(); }
the VFP code for this picklist:
<apex:pageBlockSection id="pbid" title="title" columns="2"> <apex:pageBlockSectionItem id="pbsitem"> <apex:outputText value="object name"/> <apex:SelectList id="selde" size="1" value="{!selfld}"> <apex:selectOptions value="{!objFields}"/> </apex:SelectList> </apex:pageBlockSectionItem> </apex:pageBlockSection>
and Below links will be usefull full for you to understand
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_fields_describe.htm
http://boards.developerforce.com/t5/Apex-Code-Development/Best-Way-to-Get-All-Picklists-and-Values-for-an-Object/td-p/363471
and for search functionality see below link
http://boards.developerforce.com/t5/Visualforce-Development/search-records-in-an-object-and-display-in-visualforce-page/td-p/485597
Mark it as Solution if it Answers your Question.
Hi,
Below code sample can display Object records in VFP,
Here what do you mean by Picklist Fieldvise.
Can you explain clearly what you are looking for?
I think the above code can be used to get what you are looking for
no it'snot
actual for picklist means selectlist in visualforce
selectlist has accountname,account number,phone ,website
like wise we can search
Hi,
What are you looking for? Implementing search functionality In VFP or what?
if you can able to spend some time in writing Question it will be easy for Board members to answer you.
yah i want to implement search functionality in visualforce
actual for picklist means selectlist in visualforce
selectlist has accountname,account number,phone ,website,createddate
like wise we can search
Hi,
Yes you can do this Through VFP and APex.
You can use Schema.SobjectType to get the describe information about object, fields and get that into Picklist.
By this you can get all the information regarding the object.
the VFP code for this picklist:
and Below links will be usefull full for you to understand
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_fields_describe.htm
http://boards.developerforce.com/t5/Apex-Code-Development/Best-Way-to-Get-All-Picklists-and-Values-for-an-Object/td-p/363471
and for search functionality see below link
http://boards.developerforce.com/t5/Visualforce-Development/search-records-in-an-object-and-display-in-visualforce-page/td-p/485597
Mark it as Solution if it Answers your Question.