+ Start a Discussion
md1md1 

Showing an Ordered List using dataList

I'm using the following markup to show an ordered list in my Visualforce page:

 

<apex:dataList type="1" value="{!EmployeeFAQ.ClsSolution}" var="itemQ" id="theList" styleClass="questionsList"> <apex:outputLink value="#a{!itemQ.SCount}"> <apex:outputText value="{!itemQ.Obj.SolutionName}" /> </apex:outputLink></apex:dataList>

 

However, the result being rendered is an unordered list:

 

 

<ul class="questionsList" id="j_id0:j_id1:theList" type="1"><li id="j_id0:j_id1:theList:0" class="">...</li>......<ul>

  

Any pointers as to what could be wrong here?

 

Thanks in Advance,

-Manu 

 

BritishBoyinDCBritishBoyinDC
It was my understanding that you had to use datatable to create an ordered list?
md1md1

Thanks.

 

I'm certain that datalists are used for ordered and unordered lists and datatables for html tables.

 

The type attribute of datalist is used to render it as ordered or unordered - by default it's unordered. (ref: VF docs). 

jwetzlerjwetzler

I don't understand why that doesn't work for you.  A quick test in one of my orgs shows a proper ordered list:

 

<apex:page controller="repeatCon">

<apex:dataList value="{!accs}" var="acc" type="1">
<apex:outputLink value="/{!acc.id}"><apex:outputText value="{!acc.name}"/></apex:outputLink>
</apex:dataList>

</apex:page>

 

public class repeatCon {
public Account[] accs {get; set;}

public repeatCon() {
accs = [select name, id from account limit 5];
}
}

 

Does my example work for you?


 Edit: Actually now that I'm looking at the source it is outputting <ul> tags with a type of "1" which seems to be rendering it as if it was an ordered list.  I wonder if that's browser specific.  Definitely seems funny, I don't see any documentation anywhere on the web that looks like it supports the type attribute in that sense.  However it does render fine for me in both IE and Firefox.

Message Edited by jwetzler on 11-03-2009 04:55 PM
md1md1

Thanks, Jill!

Yes:

- It's the wrong markup so definitely the HTML is being rendered: <ul type="1"> instead of <ol>. Bug or would you suggest putting an idea up on IdeaExchange for it to render correctly?

- Oddly, like you said, browsers IE and Firefox seem to support it as an undocumented feature, while Chrome and Safari don't. 

 

-Manu 

nneufeldnneufeld

Sorry to resurrect a zombie thread, but has anyone found a solution to the above issue? 

 

It appears that the type parameter causes non-standard HTML to render out, making the lists in Chrome and Safari appear as standard lists.

marcDmarcD

This is a great example! thank you for sharing :) Now how do you make a test on this class to pass the 100% of code coverage.

 

Million thanks in advance.

 

Marc

Sai Vineeth MaddulaSai Vineeth Maddula
Can someone clearly tell me how to get an ordered list in apex:dataList. I changed type="1" still I am not getting ordered list