eric neumann wrote:
>
> Looked around but couldn't find an answer to this problem:
>
> Some of my item attributes are VERY long strings (chemical SMILES
> 50-500 characters). The usual trick is to call a javascript method
> (e.g., showLines) that inserts spaces every x chars into the long text.
>
> But how do I transform an Item attribute via a javascript call?
>
> I randomly tried: <span ex:onshow="javascript:showLines(80,
> {{.Molecule_SMILES}});"></span>
>
> but this doesn't work... should I use ex:expression or something like it?
You can write your own function in Javascript, much like the "words"
function that powers the tag cloud facet in this example:
http://people.csail.mit.edu/dfhuynh/projects/graph-based-exhibit/graph-based-exhibit2.html
The native functions are here
http://static.simile.mit.edu/exhibit/api-2.0/scripts/data/functions.js
In your own code, instead of
<span ex:content=".Molecule_SMILES"></span>
you'd need
<span ex:content="showLines(.Molecule_SMILES)"></span>
and define showLines in the same way that "words" is defined in the
example above.
David
_______________________________________________
General mailing list
[email protected]
http://simile.mit.edu/mailman/listinfo/general