jquery表格datagrid单元格显示图片及分页使用
2013-08-31 22:01
423 查看
要想达到自定义显示表格框的目的比如显示图片,超链接,按钮的形式,只需要给列添加formatter属性即可,比如显示图片:
columns: [[
{ field: 'IName', title: '显示名称', width: 50 }, //checkbox。多选框的列
{
field: 'Iurl', title: '图片', width: 80,
formatter: function (value, row, index) {
return "<img src='" + value + "' width='30' height='30'/>";
}
},
{ field: 'ImgOrder', title: '显示顺序', width: 60 }
]],
-------------------------------------分页案例:
/// <summary>
/// 设置滚动图片
/// </summary>
/// <returns></returns>
public ActionResult GetGunDong()
{
int total = 0;
int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]);
int pageSize = Request["rows"] == null ? 10 : int.Parse(Request["rows"]);
var list = giss.LoadEntities(c => c.CId == CurrentCan.Id);
total = list.Count();
var listResult = list.OrderBy(u => u.ImgOrder).Skip((pageIndex - 1) * pageSize).Take(pageSize);
var data = new { total = total, rows = from l in listResult select new { l.Id, l.Iurl, l.IName, l.CId, l.ImgOrder } };
//内部会 帮我们 序列化成json格式数据
return Json(data, JsonRequestBehavior.AllowGet);
}
columns: [[
{ field: 'IName', title: '显示名称', width: 50 }, //checkbox。多选框的列
{
field: 'Iurl', title: '图片', width: 80,
formatter: function (value, row, index) {
return "<img src='" + value + "' width='30' height='30'/>";
}
},
{ field: 'ImgOrder', title: '显示顺序', width: 60 }
]],
-------------------------------------分页案例:
/// <summary>
/// 设置滚动图片
/// </summary>
/// <returns></returns>
public ActionResult GetGunDong()
{
int total = 0;
int pageIndex = Request["page"] == null ? 1 : int.Parse(Request["page"]);
int pageSize = Request["rows"] == null ? 10 : int.Parse(Request["rows"]);
var list = giss.LoadEntities(c => c.CId == CurrentCan.Id);
total = list.Count();
var listResult = list.OrderBy(u => u.ImgOrder).Skip((pageIndex - 1) * pageSize).Take(pageSize);
var data = new { total = total, rows = from l in listResult select new { l.Id, l.Iurl, l.IName, l.CId, l.ImgOrder } };
//内部会 帮我们 序列化成json格式数据
return Json(data, JsonRequestBehavior.AllowGet);
}
相关文章推荐
- jQuery中fadeIn、fadeOut、fadeTo的使用方法(图片显示与隐藏)
- 使用Jquery实现表格动态分页
- Android学习-使用GridView以表格形式显示多张图片
- 【Lucene】使用EasyUI和JQuery配合Lucene实现数据的分页查询以及高亮显示
- Easyui 表格datagrid 的单元格内容显示方式扩展
- WPF中Datagrid其中一列使用图片显示
- EasyUI中tree,Datagrid,pagenation的使用EasyUI中Datagrid和pagenation进行关联时,再次点击pagenation时让表格数据显示的问题
- 【Lucene】使用EasyUI和JQuery配合Lucene实现数据的分页查询以及高亮显示
- Control Study->AdRotator广告控件显示自定义配置文件中广告以及与DataGrid控件结合使用显示图片(示例代码下载)
- jQuery实现图片轮播且鼠标可控制显示,使用animate函数
- 使用JQUERY对表格进行分页
- Control Study->AdRotator广告控件显示自定义配置文件中广告以及与DataGrid控件结合使用显示图片(示例代码下载)
- EasyUI中tree,Datagrid,pagenation的使用EasyUI中Datagrid和pagenation进行关联时,再次点击pagenation时让表格数据显示的问题
- 使用jQuery动态改变图片显示大小
- easyui-datagrid使用load()保持分页显示数量
- javaEE01-使用很HTML的排版标签编写“网站信息页面”,使用图片标签编写“图面显示页面”,使用列表标签编写“友情链接页面”,使用表格标签编写“首页”,框架标签表现“后台页面”
- 利用表格分页显示数据的js组件datatable的使用
- grid中显示blobImage上传的图片 通过本案例,我们实现blobImage上传的图片在grid表格中的显示。 grid的cellRender方法渲染单元格显示图片,例: 1 2 3 4 5
- jQuery Waterfall插件的使用-瀑布流图片显示
- Strust2 + JSON + jquery 分页表格显示数据