Global

Members

@name 基础数据模型类

Author:
  • wanghaiyang
Source:

@name 页面流程控制类

Author:
  • wanghaiyang
Source:

Requester示例代码

Source:
Example
function doit() {
// 注: test.json -> [null,[]]
Requester.get('ajax/test.json', {
data: '',
onsuccess: function(data){
alert(data)
}
});

// 注: 跨域会导致请求出错
Requester.get('http://www.5imemo.com/other/ajax/jsonp.php', {onsuccess: function(data){alert(data.success)}});

// 注: JSONP跨域不会导致出错
Requester.JSONP('http://www.5imemo.com/other/ajax/jsonp.php', {callback: function(data){ alert(data.id)}});
}

Requester请求管理类

Author:
  • haiyang5210
Source:

Template模板管理类

Author:
  • wanghaiyang
Source:

事件绑定与解绑

Source:

全局事件处理接口 注:不支持onsuccess

Source:

前端构造测试数据

Source:

发送JSONP请求

Source:

发送JSONP请求

============================================
Source:

合并模板与数据

Source:

在当前元素前后兄弟节点中查找有className的元素

Source:

在当前元素直系祖父节点中查找有className的元素

Source:

处理404错误

Source:

对数组进行排序

Source:

对目标字符串进行格式化

Source:

将innerHTML生成的元素append到elem后面

Source:

将innerHTML生成的元素append到elem后面

Source:

按钮控件

Author:
  • haiyang5210
Source:

渲染控件

Source:

移除指定属性值

Source:

给elem绑定onenter事件

Source:

给elem绑定onesc事件

Source:

获取Target

Source:

获取唯一id

Source:

获取所有的属性值

Source:

获取指定属性值

Source:

解析模板字符串流[增加target]

Source:

设置按钮的显示文字

Source:

设置按钮的显示文字

Source:

设置新的值,如果两个值不同,就会触发PropertyChangedEvent.

Source:

销毁Model

Source:

Methods

appendControl(uiObj)

父控件添加子控件. 注: 将子控件加到父控件下面的容器中也可以调用appendSelfTo
Parameters:
Name Type Description
uiObj Control 子控件.
Source:

clear()

清除所有监听器
Source:

(protected) createMain()

生成主DOM
Source:

(protected) dispose()

释放控件
Source:

(protected) enterControl(argMap)

Control的主要处理流程
Parameters:
Name Type Description
argMap Object arg表.
Source:

getByFormname(formname)

通过formname访问子控件
Parameters:
Name Type Description
formname String 子控件的formname
Source:
Example
<button hui-type="Button" hui-formname="save">Save</button>
var save = hui.Control.getByFormname('save');

(protected) getClass() → {String}

获取dom子部件的css class
Source:
Returns:
Type
String

getFormname(control)

获取表单控件的表单名
Parameters:
Name Type Description
control Object
Source:

getId() → {String}

获取dom子部件的id
Source:
Returns:
Type
String

getInnerHTML(elem) → {String}

获取控件的innerHTML
Parameters:
Name Type Description
elem HTMLElement 默认为控件主DOM[可选]
Source:
Returns:
Type
String

getMain() → {String}

获取控件的elem(nodejs). 注:控件即使不需要显示任何内容也必须有一个挂载的elem(可以是隐藏的),
Source:
Returns:
Type
String

getParamMap()

获取子控件的值,返回一个map
Source:

hide()

隐藏控件
Source:

initBehavior()

绑定事件
Source:

(protected) initOptions(options)

初始化参数
Parameters:
Name Type Description
options Object 参数集合
Source:

isDisabled() → {boolean}

判断控件不可用状态
Source:
Returns:
Type
boolean

off(eventType, listener)

移除监听器
Parameters:
Name Type Description
eventType String 事件类型.
listener function 监听器.
Source:

on(eventType, listener)

添加监听器
Parameters:
Name Type Description
eventType String 事件类型.
listener function 监听器.
Source:

one(eventType, listener)

添加一次性监听器
Parameters:
Name Type Description
eventType String 事件类型.
listener function 监听器.
Source:

render()

渲染控件
Source:

setDisabled(disabled)

设置控件不可用状态
Parameters:
Name Type Description
disabled Boolean
Source:

setInnerHTML(html, elem) → {String}

设定控件的innerHTML[nodejs&browser]
Parameters:
Name Type Description
html String innerHTML
elem HTMLElement 默认为控件主DOM[可选]
Source:
Returns:
Type
String

setReadonly(disabled)

设置控件不可用状态
Parameters:
Name Type Description
disabled Boolean
Source:

setSize()

设置控件width和height
Source:

setValueByTree(paramMap)

给控件树一次性赋值
Parameters:
Name Type Description
paramMap Object
Source:

show()

显示控件
Source:

trigger(eventType)

触发事件
Parameters:
Name Type Description
eventType String 事件类型.
Source:

validate()

验证控件的值
Source:

发送Requester请求(url, data, onsuccessopt) → {XMLHttpRequest}

Parameters:
Name Type Attributes Description
url String 发送请求的url地址
data String 发送的数据
onsuccess function <optional>
请求成功之后的回调函数,function(XMLHttpRequest xhr, string responseText)
Source:
See:
  • Requester.request
Returns:
发送请求的XMLHttpRequest对象
Type
XMLHttpRequest