AI智能
改变未来

easyUI工作笔记


表格

formatter方法

表格动态点击事件

  • easyUI脚本
<div data-options=\"region:\'center\',border:false\"><table id=\"prepaidDepositdatagrid\" style=\"width: 100%; height: 100%\"data-options=\"border:true,pageSize:20,rownumbers:true,autoRowHeight:false,toolbar:toolbar,singleSelect:true,pagination:true,rowStyler: function(index,row){return {style:\'height:30px\'};},url:\'${ctx}/bn/zffw/yljg/yck/index_Search?_m=load\',method:\'post\'\"><thead><th data-options=\"field:\'xfje\',width:100,halign:\'center\',formatter: function(value,row,index){return fnXfje(value,row)}\">消费金额</th></tr></thead></table></div>
  • jQuery代码
function fnXfje(value,row){return \'<a style=\"color:#337ab7\" href=\"javascript:void(0)\" οnclick=\"toSumOfConsumptionBill(\\\'\'+row.id+\'\\\',\\\'\'+row.xfje+\'\\\')\">\'+value+\'</a>\';}function toSumOfConsumptionBill(id,xfje) {$(\'<div></div>\') .dialog({id : \'dg-yljg-ycgl-billDetail\',title : \'<i class=\"fa fa-windows\"></i><span class=\"dialog-title\">消费账单(详情)<span>\',width : 450,height : 600,closed : false,cache : false,border : false,maximizable : true,resizable : true,href : \'${ctx}/bn/zffw/yljg/yck/billDetail?_m=init&id=\' + id +\'&sumJe=\'+xfje ,modal : true,onClose : function() {$(this).dialog(\'destroy\').remove();},buttons : [{id : \"btn-yljg-ycgl-billDetail-back\",text : \'<i class=\"fa fa-reply\" aria-hidden=\"true\"></i>返回\',handler : function() {$(\"#dg-yljg-ycgl-billDetail\").dialog(\'close\');}} ]});}

表格匹配数据库数据库信息

  • easyUI脚本
<div data-options=\"region:\'center\',border:false\"><table id=\"prepaidDepositdatagrid\" style=\"width: 100%; height: 100%\"data-options=\"border:true,pageSize:20,rownumbers:true,autoRowHeight:false,toolbar:toolbar,singleSelect:true,pagination:true,rowStyler: function(index,row){return {style:\'height:30px\'};},url:\'${ctx}/bn/zffw/yljg/yck/index_Search?_m=load\',method:\'post\'\"><thead><tr><th data-options=\"field:\'lzid\',width:100,halign:\'center\',formatter: function(value,row,index){return fnLzid(value)}\">楼幢</th></tr></thead></table></div>
  • jQuery代码
function fnLzid(value){var fwjzw = $.ajax({url : \'${ctx}/bn/zffw/yljg/yck/findFwjzw?_m=exec\',type : \"post\",async : false,data : {id:value}});console.log(fwjzw);var text = fwjzw.responseText;var json = JSON.parse(text);return json.fwjzwmc;}
  • java代码
/*** @Title: findFwjzw* @Description: 根据ID查找-房屋建筑物* @param request* @return* @return BnYljgFwjzw    返回类型* @throws*/@RequestMapping(value = \"findFwjzw\", params = \"_m=exec\")@ResponseBodypublic BnYljgFwjzw findFwjzw(HttpServletRequest request) {String id = request.getParameter(\"id\");BnYljgFwjzw bnYljgFwjzw = bnYljgFwjzwService.findUniqueById(id);return bnYljgFwjzw;}

时间

function timeStampString(time){var year = time.year+1900;var month = (time.month + 1) < 10 ? \"0\" + (time.month + 1) : time.month + 1;var date = time.date < 10 ? \"0\" + time.date : time.date;var hour = time.hours< 10 ? \"0\" + time.hours : time.hours;var minute = time.minutes< 10 ? \"0\" + time.minutes : time.minutes;var second = time.seconds< 10 ? \"0\" + time.seconds : time.seconds;return year + \"-\" + month + \"-\" + date+\" \"+hour+\":\"+minute+\":\"+second;}
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » easyUI工作笔记