jQuery EasyUI Plugins
jQuery EasyUI provides a complete collection of components for creating cross-browser web pages, including the powerful datagrid, treegrid, panel, combo, and more. Users can use these components in combination or use any one of them individually.
Plugin List
Base
Layout
Menu and Button
Form
- Form
- Validatebox
- Combo
- Combobox
- Combotree
- Combogrid
- Numberbox
- Datebox
- Datetimebox
- Calendar
- Spinner
- Numberspinner
- Timespinner
- Slider
Window
DataGrid and Tree
Plugin
Every easyui component has properties, methods, and events. Users can easily extend these components.
property
Properties are defined in jQuery.fn.{plugin}.defaults. For example, the properties of dialog are defined in jQuery.fn.dialog.defaults.
Events
Events (callback functions) are also defined in jQuery.fn.{plugin}.defaults.
Method
Syntax for calling a method: $('selector').plugin('method', parameter);
Where:
- selector is the jquery object selector.
- plugin is the plugin name.
- method is an existing method that matches the plugin.
- parameter is the parameter object, which can be an object, a string, ...
Methods are defined in jQuery.fn.{plugin}.methods. Each method has two parameters: jq and param. The first parameter 'jq' is required and refers to the jQuery object. The second parameter 'param' refers to the actual parameters passed to the method. For example, to extend the dialog component with a method named 'mymove', the code is as follows:
$.extend($.fn.dialog.methods, {
mymove: function(jq, newposition){
return jq.each(function(){
$(this).dialog('move', newposition);
});
}
});
Now you can call the 'mymove' method to move the dialog to a specified position:
$('#dd').dialog('mymove', {
left: 200,
top: 100
});
Getting Started with jQuery EasyUI
Download the library and reference the EasyUI CSS and JavaScript files in your page.
Once you have referenced the necessary EasyUI files, you can define an EasyUI component through markup or by using JavaScript. For example, to define a panel with collapsible functionality, you need to write the following HTML code:
The panel content
When creating components through markup, the 'data-options' attribute is used to support HTML5-compatible attribute names since version 1.3. So you can rewrite the code above as follows:
The panel content
The following code demonstrates how to create a combobox bound to the 'onSelect' event.