1. Wrapping YUI with WebClay
- Posted by jeremy (admin) Sep 18, 2009
- 1472 views
Euphoric suggested wrapping YUI in WebClay, so I began that process, however, I'm open for suggestions. I was able to easily create a WebClay tag for the basics of the DataTable, an example use is:
<%- yui:datatable name="a_cats" url="/aircraft/categories.wc?output=text" layout=!{ -- key, label, sortable - defaults to on, formatter - defaults to none { "id", "Id", 1, "YAHOO.widget.DataTable.formatNumber" }, { "name", "Name" } } %>
That creates a DataTable with keys, headers, formatting and it dynamically retrieves the data from the given URL. However, my problem is that YUI is so expansive in it's options I am not sure if it makes sense to wrap it. It would seem that you would have more work arounds in a wrapping then if you simply used to learn YUI itself.
Does anyone have experience with YUI and have any opinions on this matter?
Jeremy
2. Re: Wrapping YUI with WebClay
- Posted by euphoric (admin) Sep 18, 2009
- 1471 views
Euphoric suggested wrapping YUI in WebClay...
However, my problem is that YUI is so expansive in it's options I am not sure if it makes sense to wrap it.
I don't know that I said to "wrap" it, and if I did, I don't think I meant to "wrap" it.
I just meant have some kind of interface that allowed easiest ease-of-use (really, of any javasript lib the user might choose).
The WebClay user should definitely learn to use YUI in order to use it. Or scriptaculous. Or jQuery. Or whatever.
3. Re: Wrapping YUI with WebClay
- Posted by jeremy (admin) Sep 18, 2009
- 1356 views
I don't know that I said to "wrap" it, and if I did, I don't think I meant to "wrap" it.
I just meant have some kind of interface that allowed easiest ease-of-use (really, of any javasript lib the user might choose).
The WebClay user should definitely learn to use YUI in order to use it. Or scriptaculous. Or jQuery. Or whatever.
How would WebClay be responsible for making it easy to use if not by tags wrapping YUI? For instance:
<%- yui:datatable name="people" sql="SELECT id,name,age FROM people" %>
Jeremy
4. Re: Wrapping YUI with WebClay
- Posted by euphoric (admin) Sep 18, 2009
- 1420 views
How would WebClay be responsible for making it easy to use if not by tags wrapping YUI? For instance:
<%- yui:datatable name="people" sql="SELECT id,name,age FROM people" %>
Allow the user to write a function that outputs whatever they want. The tag would be something like
<%- include custom_scripts.e %> <%- script("mycustomscript") %>
In custom_scripts.e, they could define
function mycustomscript() q = "SELECT id,name,age FROM people" -- etc... end function
or they could load the script from a script file
<%- insert("mycustomscript.js") %>
You might already have a provision to do something like this. That's what they would need to learn to use.
5. Re: Wrapping YUI with WebClay
- Posted by jeremy (admin) Sep 18, 2009
- 1415 views
You can accomplish all of that with existing functionality in WebClay. For instance:
<!-- greeter.etag --> {hello} <p>Hello, <%= #name %></p> {goodbye} <p>Goodbye, <%= #name %></p>
Then, to use it in your ETML file:
<%@ include greeter.etag %> .. code ... <%- greeter:hello name="John" %> <%- greeter:goodbye name="Jim" %>
Or, you can use any function you want:
<%@ include std/sequence.e %> ... code ... <%= join({"Hello", "World"}, ",") %> ... code ...
Jeremy