东莞网站设计方案,企业网站报价模板下载,wordpress wptouch,海宁做网站做后台管理管理系统时#xff0c;基于ajax的数据操作和富有表现力的数据绑定插件jtable绝对是一个不错的选择#xff0c;他接收来自服务器端的json格式的数据。而且他是一款开源的基于jquery和jquery ui的插件#xff0c;您可以根据自己的需要修改其表现#xff0c;如css基于ajax的数据操作和富有表现力的数据绑定插件jtable绝对是一个不错的选择他接收来自服务器端的json格式的数据。而且他是一款开源的基于jquery和jquery ui的插件您可以根据自己的需要修改其表现如css甚至修改其源码让其符合您的需求。下面我将介绍在asp.net mvc3.0 和ssh框架下jtable的使用2 将相应的css (jtable.css)和jquery.jtable.zh-CN.js、jquery.jtable.min.js拷到您的项目下。3 引入插件在view中一般放在模板页中为了简单我放在AdministratorController下的Index Action对应的视图中即Index.aspx页面中4 编写javascript代码绑定数据$(#smallTypeList).jtable({title:商品小类别管理列表,paging:true,pageSize:10,selecting:true, //Enable selectingmultiselect: true, //Allow multiple selectingselectingCheckboxes: true,actions: {listAction:/Administrator/GoodsSmallTypeList,createAction:/Administrator/GoodsSmallTypeCreate,updateAction:/Administrator/GoodsSmallTypeUpdate,deleteAction:/Administrator/GoodsSmallTypeDelete},fields: {sid: {key:true,list:false,create:false,edit:false},sname: {title:名称,width:30%,inputClass:validate[required]},cid: {title:类别,width:30%,options:/Administrator/CateList},spic: {title:类别图片,width:30%,options: {暂无:暂无}}});$(#smallTypeList).jtable(load);});5 在controller中输出json为了简单省略Models层的代码笔者认为您已经具备一定的asp.net mvc的基础知识。绑定数据注意参数(jtableStartIndex,jtPageSize)第一个参数用来指定当前起始记录第二个用来指定一页显示的记录行用这两个参数实现分页。public JsonResult GoodsSmallTypeList(int jtStartIndex, intjtPageSize){try{int totalCount goodscateEntity.getAllCategorys().Count();var goodsSmallList goodscateEntity.getAllCategorys().Skip(jtStartIndex).Take(jtPageSize);return Json(new { Result OK, Records goodsSmallList, TotalRecordCount totalCount });}catch(Exception ex){return Json(new { Result ERROR, Message ex.Message.ToString() });}}代码中,返回json时参数的OK表示请求状态Records表示数据集合TotalRecordCount表示总记录数。一般这些参数的约定好的不可改成其他除非你不愿意使用。您可以在jtable源码中进行修改。publicJsonResult GoodsSmallTypeCreate(tb_goodsCategory category){try{if (!ModelState.IsValid){return Json(new { Result ERROR, Message 请填写信息完整});}bool l goodscateEntity.InsertGoodsCategory(category);return Json(new { Result OK, Record category });}catch(Exception ex){return Json(new { Result ERROR, Message ex.Message.ToString() });}}/// ///修改商品类型/// /// /// publicJsonResult GoodsSmallTypeUpdate(tb_goodsCategory category){try{bool l goodscateEntity.ModifyGoodsCateGory(category);return Json(new { Result OK, Record category });}catch(Exception ex){return Json(new { Result ERROR, Message ex.Message.ToString() });}}/// ///删除商品类型/// /// /// public JsonResult GoodsSmallTypeDelete(int?sid){try{bool l goodscateEntity.DeleteGoodsCategory(sid);return Json(new { Result OK});}catch(Exception ex){return Json(new { Result ERROR, Message ex.Message.ToString() });}}运行结果这样jtable的使用描述就此完成本人技术有限文中还有许多不足希望大家批评指正谢谢。使用 SSH很简单只要的struts.xml加入相关配置使其返回的数据为json即可。 当然要引入json对应的jar包哦。希望对大家有用。