JSP Libraries and AJAX - jMaki Menu, Data Table and More
(Page 5 of 5 )
The following code example shows how easy to create a multi-level Yahoo-like menu.
<a:widget name="yahoo.menu" value="{menu: [
{ label:'Must Read',
menu: [
{ label:'Slashdot', url:'http://www.slashdot.org' },
{ label:'dev.java.net', menu: [
{label : 'jMaki',url:'http://ajax.dev.java.net'}, {label : 'Glass',url:'http://glassfish.dev.java.net'}
] }
]
},
{ label:'Click me for fun!',style:{strongemphasis:true} },
{ label:'Disabled!',style:{disabled:true} },
{ label:'Yahoo!', url:'http://www.yahoo.com' },
{ label:'Sun Microsystems', url:'http://www.sun.com',style:{checked:true} },
{ label:'Oracle', url:'http://www.oracle.com' }
]}" />
Here is the output.

Using the Yahoo Datatable widget, you can create a nice sortable data table like the one here.

The code generates this output is:
<a:widget name="yahoo.dataTable" args="{
columns :[
{title : 'Company', width : 200, locked:false},
{title : 'Price', width : 75, renderer: 'usMoney'},
{title : 'Change', width : 75, renderer: 'change'},
{title : '% Change', width : 75, renderer: 'pctChange'},
{title : 'Last Updated', width : 85, renderer: 'italic'}
]}"
value="[
['A Co',71.72,0.02,0.03,'9/1 12:00am'],
['B Inc',29.01,0.42,1.47,'9/1 12:00am'],
['C Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
['D Company',52.55,0.01,0.02,'9/1 12:00am']
]" />
A Yahoo like calendar can be added using the following tag.
<a:widget name="yahoo.calendar" />

You can also add a nice dialog box like this one into your code by just dragging the Yahoo Dialog widget from palate.

Here is the code generated by dragging.
<a:widget name="yahoo.simpledlg"/>
We can change the properties of this dialog box by clicking the jMaki button at the top middle of Netbeans IDE.
Here it is:

A window will be opened if you click the jMaki button.

I changed text value to 'Are you sure?' then clicked OK. The source code will be changed automatically. You can change other arguments also.
<a:widget name="yahoo.simpledlg" args="{text:'Are you sure?'}" value="{}"/>
And the modified dialog box is as below.

You can also add Google Search or Yahoo Search by simply dragging and dropping. You can add a Google Map to your web application. You can add menus, calendars, trees, an editor, an editable table and lots of other cool widgets to your web application very easily. Install it and give it a try; you will definitely love the experience.
I tried to describe different Ajax techniques in this article. There are lots of other techniques. Try them and then decide which one suits your requirements.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |