-1

I have Category table as Category(subject text) and QA tables as QA(Question text, Answer text, Lookup(Category))

I want to create a Visualforce page as :

Category1.subject

   Question1   checkbox
   Answer1

   Question2   checkbox
   Answer2

Category2.subject
   Question3   checkbox
   Answer3

   Question4   checkbox
   Answer4.
user1003121
  • 1,169
  • 3
  • 9
  • 14

1 Answers1

0

You could do this with data tables but it's almost certainly easier to do this with nested repeats that itegerate over your categories and then iterate over the questions for each category.

<apex:repeat value="{!categories}" var="cat">
    <div>{!cat.subject}</div>
    <br/>
    <apex:repeat value="{!cat.questions__r}" var="question" />
        <div>{!question.question_text__c}</div>
        <div>{!question.answer_text__c}</div>
    </apex:repeat>
</apex:repeat>

and then your query for categories in the controller would look something like the following

[select id, subject, (select question_text... from questions__r) from category__c]
Greg Grinberg
  • 655
  • 4
  • 12