Peter Frederick wrote:
> Hi Exhibitors,
>
> I've been working on an internal Exhibit with a table but I'm having some
> trouble controlling how the columns appear.
>
> This is the current table view definition:
>
> <div ex:role="exhibit-view" ex:viewClass="Exhibit.TabularView"
> ex:columns=".start, .end, .label, .description"
> ex:columnLabels="Starting, Ending, Label, Description"
> ex:columnFormats="date {mode:short}, list, list, list"></div>
>
> .start and .end are dates in format YYYY-MM-DD, .label is the brief
> description and .description is long text (say up to 300 characters).
>
> Q1 How can I show the first two date columns in an DD MM YYYY format or DD
> MMM YYYY format?
>
First, you should declare the value type of the "start" end "end"
property to be "date". This can be done in your data file:
{
items: [
...
],
properties: {
"start" : {
valueType: "date"
},
"end" : {
valueType: "date"
}
}
}
Then you can tweak ex:columnFormats a little to get your custom formats:
ex:columnFormats="date { template: 'dd MMM yyyy' }, date { template:
'dd MMM yyyy' }, ..."
Alternatively, you can put the date format in the <body>:
<body ex:formats="date { template: 'dd MMM yyyy' }">
This causes all dates in your exhibit to be formatted that way.
> Q2 How can I set the column widths up to be useful (say 10% 10% 20% 60% for
> example). Does this have to be done via CSS? I'm a bit of a CSS novice (but
> I've got the O'Reilly book and been working on hard on it!)
>
In this case you need to specify a row template within the tabular view:
<div ex:role="view" ex:viewClass="Tabular"
ex:formats="date { template: 'dd MMM yyyy' }"
ex:columns=".start, .end, .label, .description"
ex:columnLabels="Starting, Ending, Label, Description">
<table>
<tr>
<td width="10%" ex:content=".start"></td>
<td width="10%" ex:content=".end"></td>
<td width="20%" ex:content=".label"></td>
<td width="60%" ex:content=".description"></td>
</tr>
</table>
</div>
Let me know if it doesn't work. I haven't tested this case. Note that
ex:columns are still there for sorting purposes. And ex:columnLabels are
for the column headers.
> I've been scouring the WIKI pages but info about this type of control is
> pretty sparse there. Obviously you can do HEAPS of things with smart CSS and
> a bit of javascript but that isn't my programming background :*(
>
David
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general