- 基于Jquery(>1.7)结合模板引擎的重复数据展示组件
- 默认使用arttemplate.js
- Author:戴子意 DZY
- 感谢我的妻子前前,还有调皮的儿子琮琮和璋璋
- 代码维护地址已迁移至:https://gitee.com/u5web/QW.Repeater
$("选择器").QWRepeater({参数});
$("#box").QWRepeater({
tmplId: "#datatmpl",
data: data
});
名称 | 说明 | 提示 |
---|---|---|
container | 容器 | 回调事件中可以访问 |
options | 参数 | 见下表 |
名称 | 说明 | 默认值 | 示例 | 提示 |
---|---|---|---|---|
tmplId | 模板DOM | "#datatmpl" | - | jquery选择器 |
tmplContent | 模板内容 | "" | - | tmpId优先级更高 |
url | url地址 | null | - | 返回值为json |
urlParameter | url参数 | null | - | - |
urlMethod | 请求方式 | "get" | - | - |
urlDataType | 数据格式 | "json" | - | - |
data | 静态数据 | null | - | url优先级更高 |
needEmpty | 是否清空容器 | true | - | 为false适用于下拉加载 |
external | 外部参数 | null | - | 组件本身不使用此参数 |
isNullData | 空值判定方法 | function (d) {return !d;} | 回调参数为静态数据data | |
onBeforeLoadData | 数据加载前 | null | function (o) {} | 回调参数为实例的options |
onLoadDataed | 数据加载后 | null | function (o) {} | 回调参数为实例的options |
onBeforeDraw | 界面绘制前事件 | null | function (t) {} | 回调参数为实例容器 |
onRender | 模板渲染过程 | null | function (o) {} | 回调参数为options |
onDrawed | 界面绘制后事件 | null | function (t) {} | 回调参数为实例容器 |
- options 选填 参数
var opts=databox.QWRepeater("option", { tmplId: "#datatmpl2", });
- options 选填 参数
databox.QWRepeater("reload", { tmplId: "#datatmpl2", });
- data 选填 数据
databox.QWRepeater("reloadData", { rows[{name:"1"},{name:"2"}],total:20});
- urlParameter 选填 url参数
databox.QWRepeater("reloadUrl", { page:2 });
- isEmpty 选填 是否清空容器
databox.QWRepeater("loading",true);
databox.QWRepeater("loaded");
databox.QWRepeater("destroy");
- external 选填 外部参数
var exdata=databox.QWRepeater("external");