On 04/03/2011 01:56 PM, Gerritjan Koekkoek wrote:
> Hi,
>
> I have the following livetable...(see below) (working perfectly!)
> My challenge is the following; the column countryCode is a string with a 
> comma seperated list with country codes (1 to many)
> I've graphical flags representing a country and several macro's to display 
> the flags when you feed them a string with countrycodes;
>       #ArrayOfCounties($vCountryCodeString $vCountryCodeList) =>  translates 
> a comma seperated string into a array
>       #ShowAllFlags($vCountryCodeList) =>  shows all the flags of 
> countryCodes in the array
>
> What is the best way to dynamically show (in the display of the livetable) 
> the flags of the countries represented in the countryCode collumn?

You can't do that from the server, since the UI is generated by 
JavaScript. You'll have to define a callback method that constructs the 
UI, and register it in the livetable options.

A good example functions is in XWiki.AllAttachments which also outputs 
images, for the attachment type.

>
> #set($columns = ["countryName"  ,"languageText"  ,"countryCode", "_actions" ])
> #set($columnsProperties = {
>        "countryName" : { "type" : "text", "link" : "view", "size" : 10, 
> "filterable" : true, "sortable": true },
>        "language" : { "type" : "text", "link" : "view", "size" : 10, 
> "filterable" : false, "sortable": false },
>        "countryCode" : { "type" : "text", "link" : "view", "size" : 10, 
> "filterable" : false, "sortable": false },
>        "languageText" : { "type" : "text", "link" : "view", "size" : 10, 
> "filterable" : true, "sortable": true },
>        "_avatar" : { "type" : "none", "link" : "none", "html" : "true", 
> "sortable":false },
>        "_images" : { "type" : "none", "link" : "none", "html" : "true", 
> "sortable":false },
>        "_attachments" : { "type" : "none", "link" : "none", "html" : "true", 
> "sortable":false },
>        "_actions" : { "type" : "none", "link" : "none", "html" : "true", 
> "sortable":false },
>        "doc.name" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.space" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.fullName" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.author" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.date" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.creator" : { "type" : "text", "link" : "view", "size" : "10", 
> "filterable" : true, "sortable": true },
>        "doc.creationDate" : { "type" : "text", "link" : "view", "size" : 
> "10", "filterable" : true, "sortable": true },
>        "doc.title" : { "type" : "text", "link" : "view", "size" : "20", 
> "filterable" : true, "sortable": true },
>        "_actions" : {"actions": ["edit","delete"], "displayName" : "Change"}
> })
>
> #set($options = {
> "className":"CdLSAssociations.CdLS_ATD_CountryClass",
> "translationPrefix" : "cdls_atd_country.livetable.",
> "tagCloud" : true,
> "rowCount": 20,
> "maxPages" : 10,
> "selectedColumn" : "doc.title",
> "defaultOrder" : "asc"
> })
>
> #livetable("cdls_atd_country" $columns $columnsProperties $options)


-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to