This content has been marked as final.
Show 5 replies
-
1. Re: How to insert HashTable into <h:dataTable> or <rich:dataTable>
swd847 Dec 22, 2008 10:44 PM (in response to sart)Not directly. You have to create a list of keys in a backing bean and use that as the value for the dataTable.
@In HashMap myHashMap; @Factory("keyList") List<String> keyListFactory() { List<String> keys = new ArrayList<String>(); keys.addAll(myHashMap.keySet()); return keys; }
in the xml:
<rich:dataTable value="#{keyList}" var="key" > <rich:column>#{key}</rich:column> <rich:column>#{myHashMap[key}</rich:column> </rich:dataTable>
-
2. Re: How to insert HashTable into <h:dataTable> or <rich:dataTable>
swd847 Dec 22, 2008 11:16 PM (in response to sart)Interestingly it looks like this functionality could be added to richfaces by simply copying the seam SetDataModel class and adding a few lines to SequenceDataAdaptor.java in ajax4jsf. I will file a JIRA.
-
3. Re: How to insert HashTable into <h:dataTable> or <rich:dataTable>
sart Dec 23, 2008 3:31 AM (in response to sart)Thank you very much :)
-
4. Re: How to insert HashTable into <h:dataTable> or <rich:dataTable>
sart Dec 23, 2008 4:48 AM (in response to sart)well, but i still can't return the keys of hashtable only values. i think it's because keySet() returns only values. So what should i do?
-
5. Re: How to insert HashTable into <h:dataTable> or <rich:dataTable>
ngagov Dec 26, 2008 8:51 PM (in response to sart)you can also use toArray() method for sets inside the facelet:
<rich:dataTable value="#{myHashMap.keySet().toArray()}" var="key" >
<rich:column>#{key}</rich:column>
<rich:column>#{myHashMap[key]}</rich:column>
</rich:dataTable>