easyui容易被忽略掉的部分
2016-07-13 10:47
357 查看
官方文档有这么一段话:
Each component of easyui has properties, methods and events. Users can extend them easily.
Where:
selector is the jquery object selector.
plugin is the plugin name.
method is the existing method corresponding to the plugin.
parameter is the parameter object, can be a object, string, ...
The methods is defined in jQuery.fn.{plugin}.methods. Each method has two parameters: jq and param. The first parameter 'jq' is required, which refers to that jQuery object. The second parameter 'param' refers to the really parameter that pass through the method. For example, to extend a method named 'mymove' for the dialog component, the code looks like this:
$.extend($.fn.dialog.methods, {
mymove: function(jq, newposition){
return jq.each(function(){
$(this).dialog('move', newposition);
});
}
});
Now you can call 'mymove' method to move the dialog to specified position:
$('#dd').dialog('mymove', {
left: 200,
top: 100
});
这段话其实描述了easyui使用的基本思路,以及扩展的思路。jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.methods 分别是三部分的定义位置,可以对这三个定义分别扩展(添加和重写)。
Each component of easyui has properties, methods and events. Users can extend them easily.
Properties
The properties is defined in jQuery.fn.{plugin}.defaults. For example, the dialog's properties is defined in jQuery.fn.dialog.defaults.Events
The events(callback functions) is defined in jQuery.fn.{plugin}.defaults also.Methods
The calling method syntax: $('selector').plugin('method', parameter);Where:
selector is the jquery object selector.
plugin is the plugin name.
method is the existing method corresponding to the plugin.
parameter is the parameter object, can be a object, string, ...
The methods is defined in jQuery.fn.{plugin}.methods. Each method has two parameters: jq and param. The first parameter 'jq' is required, which refers to that jQuery object. The second parameter 'param' refers to the really parameter that pass through the method. For example, to extend a method named 'mymove' for the dialog component, the code looks like this:
$.extend($.fn.dialog.methods, {
mymove: function(jq, newposition){
return jq.each(function(){
$(this).dialog('move', newposition);
});
}
});
Now you can call 'mymove' method to move the dialog to specified position:
$('#dd').dialog('mymove', {
left: 200,
top: 100
});
这段话其实描述了easyui使用的基本思路,以及扩展的思路。jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.defaults,jQuery.fn.{plugin}.methods 分别是三部分的定义位置,可以对这三个定义分别扩展(添加和重写)。
相关文章推荐
- Request对象中可以获取各种路径信息
- [转]easyui data-options的使用
- [转]EasyUI——常见用法总结
- Vue.js——使用$.ajax和vue-resource实现OAuth的注册、登录、注销和API调用
- 异常org.hibernate.QueryException: could not resolve property的原因 解决办法
- 【JDBC 报错】Connections could not be acquired from the underlying database!
- Unique Word Abbreviation
- Easy-ui dialog弹框拖动超出body后无法关闭
- UITableView没数据时用户提示如何做?
- 今天更新Android studio 2.1.2,Instant Run requires 'Tools | Android | Enable ADB integration' to be enabl
- 第12章:图形用户界面GUI
- Unique Paths
- request、response 中文乱码问题
- UITableView(表示图)
- java Integer.valueOf()方法
- UIGraphicsBeginImageContext系列知识
- 开源视频会议BigBlueButton 0.81二次开发API
- POJ 1904 King's Quest 强连通分量+二分匹配
- EasyUI datagrid : 启用行号、固定列及多级表头后,头部行号位置单元格错位的问题
- iOS App开发中UIViewController类的使用教程