1 本人刚刚接到一个bug,就是初始化时若设置了datagrid到指定页数,点击下一页显示不对,4 --> ‘4’+1=41的字符串形式,再点击超出页码范围直接到最后一页;

原因:因为 pageNumber接收的是整数型的数据,而你遇到这种bug说明你传入的非整型的数据,需要利用parseInt进行转化一下,就不会再出现这样的错误了;

function queryTable(params) {
$('#tt').datagrid({
width: $(".queryTable").width()+,
height:($(window).height()-),
queryParams: params||{},
pageNumber:parseInt(prepage)||'',
pageSize:parseInt(prerows)||''
,
singleSelect: true,
loadMsg: "Loading, please wait ...",
pageList: [,,,,,],
idField:'id',
url:'/CarlcareManager/posts/findPostLists',
method:'get',
columns:[[
{field:'post_language',title:'Language',width:'8%',align:'center'},
{field:'post_type',title:'Type',align:'center',width:'8%',formatter:function(val,obj,idx){
var rtn='';
if(val!=&&val==''){
rtn='';
}else{
switch(val){
case :
rtn='Official';
break;
case :
rtn='Skill';
break;
case :
rtn='Problem';
break;
case :
rtn='Entertainment';
break;
case :
rtn='Others';
break;
}
}
return rtn;
}},
{field:'publish_time',title:'Publishing time',width:'8%',align:'center',formatter:function(val,obj,idx){
return dateFormat(parseInt(val));
}},
{field:'username',title:'Owner',width:'8%',align:'center'},
{field:'post_title',title:'Title',width:'18%',align:'center'},
{field:'view_count',title:'Views',width:'6%',align:'center'},
{field:'reply_count',title:'Comments',width:'6%',align:'center'},
{field:'collect_count',title:'Favorites',width:'6%',align:'center',width:'10%'},
{field:'comment',title:'Marks',width:'10%',align:'center'},
{field:'post_status',title:'Status',width:'6%',align:'center',formatter:function(val,obj,idx){
var rtn='';
if(val==){
rtn='Published';
}else{
rtn='Delete';
}
return rtn;
}},
{field:'view_status',title:'Operation',width:'10%',align:'center',formatter:function(value,obj,index){
var html='';
if(value==){
// html="<a class='viewed' type='button' name='replyStatus' onclick='postDetail(obj.id,obj.post_status)' href='../customer/postDetailPage?postId="+obj.id+"&postStatus="+obj.post_status+"' value='View'>View</a>";
html="<a class='alink viewed' type='button' name='replyStatus' onclick='postDetail("+obj.id+","+obj.post_status+")' value='View'>View</a>"; }else{
// html="<a class='unviewed' type='button' name='replyStatus' onclick='postDetail(obj.id,obj.post_status)' href='../customer/postDetailPage?postId="+obj.id+"&postStatus="+obj.post_status+"' value='UnView'>UnView</a>";
html="<a class='alink unviewed' type='button' name='replyStatus' onclick='postDetail("+obj.id+","+obj.post_status+")' value='UnView'>UnView</a>"; }
return html;
}} ]],
onLoadSuccess:function(data){
},
onLoadError:function(){
}
});
$('#tt').datagrid("clearSelections");
}

2 datagrid表格初始化时总是会报错 cannot read property ‘width/height··’

我碰到的发生这种错误有两种原因(easyui datagrid内部有不能识别的数据)

a - field单词拼写错误

b - queryTable请求地址拿回来的数据格式不对,比如下面,拿回的数据若不是rows会报类似错误;

 

3 今天在使用jquery easyui时遇到一个问题,easyui的datagrid无法加载。可能原因是field里面存在空格;

easyui datagrid 遇到的坑 cannot read property ·· pageNum bug and so on的更多相关文章

  1. VS2012 easyui datagrid url访问之坑

    VS2012 easyui datagrid url访问之坑 url属性放的是地址的话 返回的json格式必须有 total 和 rows,如下: {"total":2," ...

  2. JQuery easyUI DataGrid 创建复杂列表头(译)

    » Create column groups in DataGrid The easyui DataGrid has ability to group columns, as the followin ...

  3. 反射实体自动生成EasyUi DataGrid模板 第二版--附项目源码

    之前写过一篇文章,地址 http://www.cnblogs.com/Bond/p/3469798.html   大概说了下怎么通过反射来自动生成对应EasyUi datagrid的模板,然后贴了很多 ...

  4. 反射实体自动生成EasyUi DataGrid模板

    用EasyUi Datagrid展示数据的时候总是要一下这样一段代码 <table id="dt" class="easyui-datagrid"> ...

  5. easyui datagrid remoteSort的实现 Controllers编写动态的Lambda表达式 IQueryable OrderBy扩展

    EF 结合easy-ui datagrid 实现页面端排序 EF动态编写排序Lambda表达式 1.前端页面 var mainListHeight = $(window).height() - 20; ...

  6. 数据网格和树-EasyUI Datagrid 数据网格、EasyUI Propertygrid 属性网格、EasyUI Tree 树、EasyUI Treegrid 树形网格

    EasyUI Datagrid 数据网格 扩展自 $.fn.panel.defaults.通过 $.fn.datagrid.defaults 重写默认的 defaults. 数据网格(datagrid ...

  7. easyui datagrid checkbox multiple columns have been done do

    lengku1987   2013-01-06 22:27:47   Sponsored Links   easyui datagrid checkbox multiple columns have ...

  8. easyui datagrid 禁止选中行 EF的增删改查(转载) C# 获取用户IP地址(转载) MVC EF 执行SQL语句(转载) 在EF中执行SQL语句(转载) EF中使用SQL语句或存储过程 .net MVC使用Session验证用户登录 PowerDesigner 参照完整性约束(转载)

    easyui datagrid 禁止选中行   没有找到可以直接禁止的属性,但是找到两个间接禁止的方式. 方式一: //onClickRow: function (rowIndex, rowData) ...

  9. 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页

    系列目录 前言 为了符合后面更新后的重构系统,文章于2016-11-1日重写 EasyUI Datagrid在加载的时候会提交一些分页的信息到后台,我们需要根据这些信息来进行数据分页再次返回到前台 实 ...

随机推荐

  1. Win7各版本功能对比

  2. w97常用功能代码

    1,onclick中添加日期控件 2,onpicked事件即是点击控件后触发的事件 3,dp.cal.getNewDateStr()即是点击到的日期字符串 <script> functio ...

  3. JAVA基础——时间Date类型转换

    在java中有六大时间类,分别是: 1.java.util包下的Date类, 2.java.sql包下的Date类, 3.java.text包下的DateFormat类,(抽象类) 4.java.te ...

  4. 263A

    #include<stdio.h> #include<stdlib.h> int main() { int i, j; int temp; int t_i, t_j; int ...

  5. Json常用操作

    1, 获取json字符串中属性(传统方式) import net.sf.json.JSONObject JSONObject json = JSONObject.fromObject(response ...

  6. Apache服务安全加固

    一.账号设置 以专门的用户帐号和用户组运行 Apache 服务. 根据需要,为 Apache 服务创建用户及用户组.如果没有设置用户和组,则新建用户,并在 Apache 配置文件中进行指定. 创建 A ...

  7. [LeetCode] 35. Search Insert Position_Easy tag: Binary Search

    Given a sorted array and a target value, return the index if the target is found. If not, return the ...

  8. [LeetCode] 74. Search a 2D Matrix_Medium tag: Binary Search

    Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the follo ...

  9. [洛谷]p1996约瑟夫环 &xdoj1311

    https://www.luogu.org/problemnew/show/P1996 约瑟夫环这个问题一直以来都是用循环链表写的,今天才知道有循环队列的写法.以下是要点: 1.循环队列实现环的思想, ...

  10. jquery实现记住用户名和密码

    这里我们选择的方法是cookie的方式去记录 首先我们写将用户名和密码写到cookie的js代码 //保存到cookie function save_cookies(){ if($("#re ...