function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shanky77Shanky77 

FieldSets in VisualForce Page

Can anyone suggest... . I want to display the records in row format but my below code is displaying the record in column format. I tried all combination of tr/td inside and outside of the inner as well as outer <apex:repeat> but still the result remained same.. used <apex:repeat>  with <apex:dataList> too, to test the result.. but did not get one.

 

 


<apex:pageBlock title="Add additional details to models" mode="edit">
<apex:pageBlockSection >
<apex:repeat value="{!productDetailLineItems}" var="string">
<apex:repeat value="{!fields}" var="f">

<tr>

<td>
<apex:inputField value="{!string[f.fieldPath]}"  required="{!OR(f.required, f.dbrequired)}"/>

</td>

</td>
</apex:repeat>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>

 

{!productDetailLineItems}:- is the method returing list of 'product detail line item' records..

 

product deatil line item is a custom objects which has field namely : product name/quantity/price/margin/percenatge offer/sales division.

 

my above code generate the output like this

 

record 1

 

 product name

 quantity

 price

 margin

 percentage offer

 sales division

 

record 2

 

 product name

 quantity

 price

 margin

 percentage offer

 sales division

 

record 3

 

 product name

 quantity

 price

 margin

 percentage offer

 sales division

 

 

I want an outout like this

 

record 1       product name     quantity     price     margin      percentage offer       sales division

record 2        product name     quantity     price     margin      percentage offer       sales division

record 3        product name     quantity     price     margin      percentage offer       sales division

 

 

help with advice or sample code plz

 

 

Sachin10Sachin10

The following code might be of some help:

 

PAGE:

<apex:page controller="help">
<apex:pageBlock >
<apex:pageBlockTable value="{!accntList}" var="f">
<apex:column headerValue="name" value="{!f.name}"/>
<apex:column headerValue="type" value="{!f.type}"/>

</apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

 

APEX CLASS:

public class help
{
public list<account> accntList{get;set;}

public help()
{
accntList = new List<account>();
accntList = [select id,name,type from account limit 5];
}
}

 

It displays the account records in row format.

 

 

Shanky77Shanky77

appreciate the effort. but <apex:PageBlock Table> and <apex:dataTable> is commonly used for displaying the output.. in my case i will have to take the input from the user.. secondly the index of each field in the row is coming from FieldSet method..


<apex:repeat value="{!fields}" var="f">

In my extension  ite definition is of the "{!fields}" method is as below

 public List<Schema.FieldSetMember> getFields() {
        return SObjectType.product_detail_LineItems__c.FieldSets.Prouduct_Line_Item.getFields();
        
       }

 

Any body, Any other suggestion/solution/guidance plz