Hi David,

Thanks for your suggestion.

I copied the script tag verbatim from your email into the <head> tag
of my page.  The Exhibit section of the <head> tag now looks like
this:
<!-- Begin Exhibit Scripts and Styles -->
<link href="../data/ce-re-test.json" type="application/json"
rel="exhibit/data" />

<script src="http://static.simile.mit.edu/exhibit/api-2.0/exhibit-
api.js" type="text/javascript"></script>
<script src="http://static.simile.mit.edu/exhibit/extensions-2.0/time/
time-extension.js" type="text/javascript"></script>
<script src="http://static.simile.mit.edu/exhibit/extensions-2.0/
timeplot/timeplot-extension.js"></script>
<script src="http://static.simile.mit.edu/exhibit/extensions-2.0/chart/
chart-extension.js" type="text/javascript"></script>

<script>
    Exhibit.FunctionUtilities.registerSimpleMappingFunction(
        "time-format",
        function(n) {
           return (n < 100) ? n.toString() : (Math.floor(n / 60) + ":"
+
(n % 60));
        },
        "text"
    );
</script>

I then modified the view code to look like this:
                        <!-- Begin Tabular View -->
                        <div
                                ex:role="view"
                                ex:label="Tabular View"
                                ex:viewClass="Tabular"
                                ex:collectionID="Deployment"
                                ex:rowStyler="zebraStyler"
                                ex:sortColumn="0"
                                ex:sortAscending="false"
 
ex:columns=".label, .target, .recipe, .sindatetime, .srndatetime, time-
format(date-range(.sindatetime, .srndatetime, 'minute'))"
                                ex:columnLabels="Release, Target SID, Recipe, 
SIN Date Time, SRN
Date Time, SIN-SRN Elapsed Time (Minutes)">
                        </div>
                        <!-- End Tabular View -->

Now when I bring up the page, I get the following error rendered in
the browser :
Caught exception: undefined
Details: No such function named time-format

I've tested with both IE 7.0 & FF 3.0 on WinXP with SP3.

Any thoughts on what I'm doing wrong?

Thx,
-Mark



On Jan 30, 11:52 pm, David Huynh <[email protected]> wrote:
> mleden wrote:
> > I'm using the Exhibit Tabular view.  One of my columns represents an
> > elapsed time, so I use:
> > date-range(.sindatetime, .srndatetime, 'minute')
> > where .sindatetime and .srndatetime come from the JSON "database".
> > Works beautifully, except when the elapsed time gets up into the
> > hundreds.  At which point, I'd prefer to display something like:
> > 2:22
> > instead of:
> > 142
>
> > Thanks in advance for any suggestions!
>
> Mark,
>
> I'd recommend defining atime-formatfunction
>
> <script>
>     Exhibit.FunctionUtilities.registerSimpleMappingFunction(
>         "time-format",
>         function(n) {
>            return (n < 100) ? n.toString() : (Math.floor(n / 60) + ":" +
> (n % 60));
>         },
>         "text"
>     );
> </script>
>
> And then you can use this expression
>
>    time-format(date-range(.sindatetime, .srndatetime, 'minute'))
>
> David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to