EasyUI datagrid自适应问题解决
在使用js 动态创建EasyUI datagrid时,如果设置fit为true,在显示的时候数据的高度为固定高度不能自适应
解决办法是把fit设为false。
但这样设置后又有个问题,如果把columns定义在js里面,及时宽度设置为百分百,单元格的宽度不能随着浏览器的大小而变化
解决办法是把columns定义在页面html里。
最后的代码如下:
html代码
<table id="grid" title="考勤数据" style="width:100%;height:auto">
<thead>
<tr>
<th field="GUID" hidden="hidden">ID</th>
<th field="EmpName" width="20%">姓名</th>
<th field="KqDate" width="20%">日期</th>
<th field="KqTime" width="20%">时间</th>
<th field="IsInvalid" width="16%">是否有效</th>
<th field="Remark" width="20%">备注</th>
</tr>
</thead>
</table>
js代码
$('#grid').datagrid({
url: '/Checking/GetAll?r=' + Math.random(), //数据接收URL地址
iconCls: 'icon-view', //图标
fit: false, //自动适屏功能
nowrap: true,
autoRowHeight: false, //自动行高
autoRowWidth: true,
striped: true,
collapsible: false,
remoteSort: true,
idField: 'GUID', //主键值
pagination: true, //启用分页
rownumbers: true, //显示行号
multiSort: true, //启用排序
sortable: true, //启用排序列
fitcolumns: true,
queryParams: $("#searchform").form2json(), //搜索条件查询
singleSelect: true,
/*columns: [[
{ field: 'GUID', hidden: true },
{ field: 'EmpName', title: '姓名', width: '20%', sortable: true },
{ field: 'KqDate', title: '日期', width: '20%', sortable: true },
{ field: 'KqTime', title: '时间', width: '20%', sortable: true },
{ field: 'IsInvalid', title: '有效否', width: '16%', sortable: true },
{ field: 'Remark', title: '备注', width: '20%' }
]],*/
toolbar: '#divtoolbar'
});
}
EasyUI datagrid自适应问题解决的更多相关文章
- EasyUI DataGrid自适应高度
我的页面分为上下两部分,但发现下面有DataGrid的高度总是自动改,数据根本显示不出来. 后来在博客园里看到这个:http://www.cnblogs.com/xienb/archive/2013/ ...
- easyui datagrid标题列宽度自适应
最近项目中使用easyui做前端界面,相信大部分使用过easyui datagrid的朋友有这么一个疑问:如果在columns中不设置width属性能不能写个方法让datagrid的头部标题和数据主体 ...
- 一步步实现 easyui datagrid表格宽度自适应,效果非常好
一步步实现 easyui datagrid表格宽度自适应,效果非常好: 一.设置公共方法,使得datagrid的属性 fitColumns:true $(function(){ //初始加载,表格宽 ...
- 控制EasyUI DataGrid高度
这次要说的是控制EasyUI的高度,平时我公司的项目,用EasyUI较多,然后datagrid这个组件是用的非常多的.平时我们都是固定高度,常见代码如下: <table ...
- EasyUI datagrid优化
easyui datagrid 在IE上加载速度慢, 150行数据就无法忍受了. firefox加载速度还可以. jquery easyui datagrid使用参考 http://www.cnblo ...
- jquery easyui datagrid使用参考
jquery easyui datagrid使用参考 创建datagrid 在页面上添加一个div或table标签,然后用jquery获取这个标签,并初始化一个datagrid.代码如下: 页面上 ...
- Easyui Datagrid扩展fixRownumber方法 转载
$.extend($.fn.datagrid.methods, { fixRownumber : function (jq) { return jq.each(function () { var pa ...
- JQuery easyUI DataGrid 创建复杂列表头(译)
» Create column groups in DataGrid The easyui DataGrid has ability to group columns, as the followin ...
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页
系列目录 前言 为了符合后面更新后的重构系统,文章于2016-11-1日重写 EasyUI Datagrid在加载的时候会提交一些分页的信息到后台,我们需要根据这些信息来进行数据分页再次返回到前台 实 ...
随机推荐
- 两页pdf打印为一页,并且放大(打印英文pdf常用)
多很英文书籍都是小书,若我们直接打印它的pdf会很厚,比如我要打印一本 thinking in C++,就要800+页.不如把两页打成一页.但是打成一页之后又太小了,需要放大.具体方法如下: 前提 ...
- 游戏中VIP会员模块的简单实现
哈哈 今天周末有时间,再整理一篇博文上来,虽然已经不做游戏老长时间了,但还是要把以前做过的东西总结一下,借此可以回顾以前的东西,也可以分享给大家. 今天说一下游戏中VIP会员模块的实现思路.每款游戏 ...
- window下gvim中文界面改变成英文界面
中文环境下设置GVIM的界面.菜单.提示为英文语言 修改你的_vimrc,通常为类似C:\Program Files\Vim 加入以下语句至末尾 " set the menu & t ...
- 锋利的JQuery-认识Jquery
今天开始学习菜鸟的JQuery,这本书在一前看过一遍了,但是由于虽然看了,但是将近一年在工作中基本上没有用上,很是悲催,菜鸟想,用一到两个星期时间把这本书看一遍吧.就像菜鸟前面的jsdom一样,菜鸟写 ...
- 获取html上元素的真正坐标
使用HTML元素的style.left,style.top,style.width,style.height以及width,height属性,都不能获得元素的真正位置与大小,这些属性取出来的都是原来的 ...
- 使用Spring框架的12个开源项目
使用Spring框架的12个开源项目 http://www.csdn.net/article/2013-10-14/2817176-open-source-projects-that-use-spri ...
- FormsAuthentication实现单点登录
原文地址:http://www.wlm.so/Article/Detail/lmb48bk9f690n00000 单点登录,这种在网络非常常见,在这里讨论的是实现同一主域下的子站间的单点登录,同样也适 ...
- BZOJ3509: [CodeChef] COUNTARI
3509: [CodeChef] COUNTARI Time Limit: 40 Sec Memory Limit: 128 MBSubmit: 339 Solved: 85[Submit][St ...
- Java [leetcode 25]Reverse Nodes in k-Group
题目描述: Given a linked list, reverse the nodes of a linked list k at a time and return its modified li ...
- ECSHOP:首页实现显示子分类商品,并实现点击Tab页切换分类商品
例子:首页实现显示子分类商品,并实现点击Tab页切换分类商品(非AJAX) 开始: 1. 打开调试开关 文件地址:include/cls_template.php 找到 : functi ...