easyui中datagrid用法,加载table数据与标题
加载标题写法:
多行标题:columns: [[
columns: [[
{ field: 'itemid', title: 'Item ID', rowspan: 2, width: 80, sortable: true },
{ field: 'productid', title: 'Product ID', rowspan: 2, width: 80, sortable: true },
{ title: 'Item Details', colspan: 4 }
], [
{ field: 'listprice', title: 'List Price', width: 80, align: 'right', sortable: true },
{ field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right', sortable: true },
{ field: 'attr1', title: 'Attribute', width: 100 },
{ field: 'status', title: 'Status', width: 60 }
]]
单行标题用Js实现:
$('#tt').datagrid({
columns: [[
{ field: 'itemid', title: 'Item ID', width: 80 },
{ field: 'productid', title: 'Product ID', width: 80 },
{ field: 'listprice', title: 'List Price', width: 80, align: 'right' },
{ field: 'unitcost', title: 'Unit Cost', width: 80, align: 'right' },
{ field: 'attr1', title: 'Attribute', width: 100 },
{ field: 'status', title: 'Status', width: 60 }
]]
});
实现一个table的数据加载例子:
静态:
var data_ = [{
"dataindex0": "1",
"dataindex1": "Y08",
"dataindex2": "Y00000000158",
"dataindex3": "注",
"dataindex4": "Z",
"dataindex5": "注",
"dataindex6": "250",
"dataindex7": "东北厂",
"dataindex8": "国",
"dataindex9": "123123",
"dataindex10": null,
"dataindex11": null,
"dataindex12": null,
"dataindex13": null
},
{
"dataindex0": "1",
"dataindex1": "Y08",
"dataindex2": "Y00000000158",
"dataindex3": "注",
"dataindex4": "Z",
"dataindex5": "注",
"dataindex6": "250",
"dataindex7": "东北厂",
"dataindex8": "国",
"dataindex9": "123123",
"dataindex10": null,
"dataindex11": null,
"dataindex12": null,
"dataindex13": null
}];
方法一:
$('#dg').datagrid({
fit: true,
checkOnSelect: true,
selectOnCheck: true,
singleSelect: true,
fitColumns: true,
data:data_,
//pageSize:100,
//pagination:true,
columns: [[
{ field: 'dataindex0', title: 'dataindex0', width: 80 },
{ field: 'dataindex1', title: 'dataindex1', width: 80 },
{ field: 'dataindex2', title: 'dataindex2', width: 80 },
{ field: 'dataindex3', title: 'dataindex3', width: 80 },
{ field: 'dataindex4', title: 'dataindex4', width: 80 },
{ field: 'dataindex5', title: 'dataindex5', width: 80 },
{ field: 'dataindex6', title: 'dataindex6', width: 80 },
{ field: 'dataindex7', title: 'dataindex7', width: 80 },
{ field: 'dataindex8', title: 'dataindex8', width: 80 },
{ field: 'dataindex9', title: 'dataindex9', width: 80 }
]]
});
方法二:
$('#dg').datagrid({
fit: true,
checkOnSelect: true,
selectOnCheck: true,
singleSelect: true,
fitColumns: true,
//pageSize:100,
//pagination:true,
columns: [[
{ field: 'dataindex1', title: 'dataindex1', width: 80 },
{ field: 'dataindex2', title: 'dataindex2', width: 80 },
{ field: 'dataindex3', title: 'dataindex3', width: 80 },
{ field: 'dataindex4', title: 'dataindex4', width: 80 },
{ field: 'dataindex5', title: 'dataindex5', width: 80 },
{ field: 'dataindex6', title: 'dataindex6', width: 80 },
{ field: 'dataindex7', title: 'dataindex7', width: 80 },
{ field: 'dataindex8', title: 'dataindex8', width: 80 },
{ field: 'dataindex9', title: 'dataindex9', width: 80 },
{ field: 'dataindex10', title: 'dataindex10', width: 80 }
]]
});
easyui中datagrid用法,加载table数据与标题的更多相关文章
- WPF DataGrid 性能加载大数据
WPF(Windows Presentation Foundation)应用程序在没有图形加速设备的机器上运行速度很慢是个公开的秘密,给用户的感觉是它太吃资源了,WPF程序的性能和硬件确实有很大的关系 ...
- Ajax在jQuery中的应用---加载异步数据
Ajax是Asynchronous JavaScript and XML的缩写,其核心是通过XMLHttpRequest对象,以一种异步的方式,向服务器发送数据请求,并通过该对象接收请求返回的数据,从 ...
- 【转载】WPF DataGrid 性能加载大数据
作者:过客非归 来源:CSDN 原文:https://blog.csdn.net/u010265681/article/details/76651725 WPF(Windows Presentatio ...
- EasyUI datagrid动态加载json数据
最近做一个项目,要求是两张张表可能查找出10多种不同的结果集. 如果想只用一个表格就把全部的结果不同的显示出来那么就肯定不同使用固定的字段名字,要通过动态加载后台返回来的数据把它显示出来就必须动态加载 ...
- EasyUI中, datagrid用loadData方法绑定数据。
$("#dg").datagrid("loadData", { , " }, { "ck": "1", &qu ...
- layui中,同一个页面动态加载table数据表格
效果图: 前端代码: <div class="layui-fluid" id="record-user" hidden="hidden" ...
- easyui datagrid 异步加载数据时滚动条有时会自动滚到最底部的问题
在使用easyui 的datagrid异步加载数据时发现滚动条有时会自动滚到最底部.经测试发现,如果加载数据前没有选中行则不会出现这个问题.这样我们可以在重新异步加载数据前取消选中行就可以避免这个问题 ...
- easyui datagrid 动态加载数据 渲染问题,表格错位问题
$('#dg').datagrid({ url:'datagrid_data.json', columns:[[ {field:'code',title:'Code',width:100}, {fie ...
- jquery easyui easyui-treegrid 使用异步加载数据
jquery easyui easyui-treegrid 使用异步加载数据 jquery easyui easyui-treegrid 异步请求 >>>>>>&g ...
随机推荐
- Hadoop Streaming
原文地址:http://hadoop.apache.org/docs/r1.0.4/cn/streaming.html Hadoop Streaming Streaming工作原理 将文件打包到提交的 ...
- C 标准IO 库函数与Unbuffered IO函数
先来看看C标准I/O库函数是如何用系统调用实现的. fopen(3) 调用open(2)打开指定的文件,返回一个文件描述符(就是一个int 类型的编号),分配一 个FILE 结构体, 通常里面包含了: ...
- 选择问题 and 字谜游戏问题
#include <stdio.h> #include <stdlib.h> // 第一题 // 找出N个数的第k个最大者 // 方法1:排序(冒泡),降序找出第k个值 // ...
- uva 116 - Unidirectional TSP (动态规划)
第一次做动规题目,下面均为个人理解以及个人方法,状态转移方程以及状态的定义也是依据个人理解.请过路大神不吝赐教. 状态:每一列的每个数[ i ][ j ]都是一个状态: 然后定义状态[ i ][ j ...
- python标准库介绍——9 copy模块详解
==copy 模块== ``copy`` 模块包含两个函数, 用来拷贝对象, 如 [Example 1-64 #eg-1-64] 所示. ``copy(object) => object`` 创 ...
- spring mvc 依赖包
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop&l ...
- MySQL数据分组GROUP BY 和HAVING
对于分组的理解,可以这样:对GROUP BY子句后面跟随的列名进行分组,然后对每一个分组而不是整个表进行操作. 举例如下:在产品表中,检索每一个供应商提供的商品的数量. mysql> SELEC ...
- composer安装第三方的库packagist.org(laravel框架引入第三方库)
建立composer.json composer require phpoffice/phpexcel //安装一个excel扩展库 composer require gregwar/captcha ...
- C 多级指针
C多级指针 *p -----> &p1 *(*p) ----->*(&p1) = &p ...
- 用 Qt 中的 QDomDocument类 处理 XML 文件
XML,全称为 “可扩展标记语言”(extensible markup language).是一种非常方便的数据交换与数据存储的工具. 我们在取得一个XML格式的文件后,需要作句法分析去提取发布方提供 ...