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. 并发编程---IO模型

    IO模型 任务的提交方式有两种: 同步:应用程序提交完任务,等待结果结果,之后在执行下一个任务 异步:应用程序提交完任务,继续执行不等待结果,任务执行完,会自动出发异步中的会带哦函数 同步不等于阻塞: ...

  2. Building an (awesome) API with NancyFX 2.0 + Dapper

    http://blog.nandotech.com/post/2016-10-25-nancyfx-webapi-dapper/?utm_source=tuicool&utm_medium=r ...

  3. .ashx文件与.ashx.cs

    如果项目是“新建网站”,添加的ashx是没有ashx.cs的:如果是新建"asp.net web 应用程序",添加的ashx是有ashx.cs的. 今天做项目测试遇到一个问题,因为 ...

  4. 算法笔记-PHP实现队列的操作

    [队列]先进者先出,这就是典型的“队列”.         最基本的两个操作:入队enqueue(),放一个数据到队列尾部:出队dequeue(),从队列头部取一个元素.队列可以用数组或者链表实现,用 ...

  5. js分页器插件

    <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...

  6. CentOS 7 时间, 日期设置 (含时间同步)

    from http://blog.itnmg.net/centos-7-time-date/ yum install ntp //安装ntp服务systemctl enable ntpd //开机启动 ...

  7. .NET拾忆:FormData文件上传

    方法1.FormData简单实现 后端: using System; using System.Collections.Generic; using System.IO; using System.L ...

  8. 阿里云服务器用smtp发送邮件返失败

    阿里云使用SMTP发送邮件失败,因为阿里云服务器屏蔽了25端口,所以发送不成功,解决办法改用587发送QQ邮件,且必须使用SSL,否则不成功. 经测试QQ的465,995不能使用. https://b ...

  9. selenium元素高亮显示

    selenium元素高亮显示: 采用js注入的方式,通过更改元素样式来实现. border:2px 边框  solid red 红色 def hightlight(self,element): &qu ...

  10. dotnet 命令

    以下用实例串起dotnet常用命令,带你玩转dotnet命令. 1.创建(dotnet new) 首先我们创建一个项目,这里我们创建控制台程序,命令如下图所示. dotnet new dotnet n ...