解析器 vjsp.Parser
解析页面
(static).parse(rootElementopt)
参数:
Name | Type | Attributes | Description |
---|---|---|---|
rootElement | HtmlElement | optional | 从哪个节点开始解析 |
示例:
vjsp.Parser.parse('.vjsp-formWrap');
获取所有的控件对象
(static).getWidgets() → {Widgets}
示例:
var widgets = vjsp.Parser.getWidgets();
返回: 控件对象数组
Type Widgets
根据name获取Widget
(static).getWidgetByName(name) → {Widget}
示例:
var widget = vjsp.Parser.getWidgetByName('textbox1');
参数:
Name | Type | Description |
---|---|---|
name | String | 控件对象的name |
返回: 控件对象
Type Widget
根据type获取Widget
(static).getWidgetsByType(type) → {Widget}
示例:
var datagrids = vjsp.Parser.getWidgetsByType('datagrid');
参数:
Name | Type | Description |
---|---|---|
type | String | 控件对象的类型 |
返回: 控件对象数组
Type Widgets
注册控件
(static).registerWidget(widgetName, widgetClass, renderAttrs, renderFunc, parseAttrs, parseFunc)
参数:
Name | Type | Description |
---|---|---|
widgetName | String | 控件类对应类型名称 |
widgetClass | Class | 控件类(完全实现控件接口) |
renderAttrs | Objects | 渲染时控件属性 |
renderFunc | function | 渲染时扩展函数 |
parseAttrs | Objects | 解析时控件属性 |
parseFunc | function | 解析时扩展解析函数 |
解析前事件
(static).onBeforeParse(callback)
示例:
vjsp.Parser.onBeforeParse(function(){
alert('onBeforeParse');
});
参数:
Name | Type | Description |
---|---|---|
callback | function | 事件回调函数 |
解析后事件
(static).onAfterParse(callback)
示例:
vjsp.Parser.onAfterParse(function(){
alert('onAfterParse');
});
参数:
Name | Type | Description |
---|---|---|
callback | function | 事件回调函数 |