- 代码收藏
- JS 获取图片Base64
- css 缩放
- JS调用浏览器下载
- 腾讯云服务器 数据磁盘扩容
- JS删除指定下标的数组
- Js 关闭chrome内核浏览器 标签页
- js时间转毫秒
- JS 二维数组排序输出HTML
- uniapp webview 加载H5,手机返回键处理成返回上一页,上一个网页
- uniapp uni.navigateTo 跳转失败无效的可能原因
- uniapp 设置顶部状态条背景颜色
- 网口小票打印机IP查看方法
- 梦行表格thead 固定,tbody 滚动CSS代码
- JS操作梦行表格按TR属性值排序
- 浏览器插件开发之检测网络请求参数
- 编辑器追加商品调用按钮
- H5网页不缩放,查看图片时双指缩放时,跳图片URL缩放看图 js代码event.touches.length
- html5属性 contenteditable 在微信手机上不生效,或有时点击没反应,解决方案
JS操作梦行表格按TR属性值排序
1JS
var last_v,last_id; $("td>span[class~='sorting']").click(function(){ if(!$(this).attr('attr_key')){return false;} attr_key=$(this).attr('attr_key'); $("#<?php echo $module['module_name'];?>_table tbody>tr ").removeAttr('each'); last_num=0; last_v=-999999.99; last_id=''; /**/ if($(this).attr('class')!='sorting_desc'){ $("#<?php echo $module['module_name'];?>_table thead td .sorting_desc").attr('class','sorting'); $("#<?php echo $module['module_name'];?>_table thead td .sorting_asc").attr('class','sorting'); $(this).attr('class','sorting_desc'); $("#<?php echo $module['module_name'];?>_table tbody>tr ").each(function(index){ if($(this).attr(attr_key)==undefined){return true;} if($(this).attr('each')){return true;} this_line=$("#"+$(this).attr('id')); this_id=$(this).attr('id'); this_val=parseFloat($(this).attr(attr_key)); if(this_val==0){ $("#"+$(this).attr('id')).insertBefore($("#<?php echo $module['module_name'];?>_table tbody>tr:last-child ")); return true; } if(last_id!='' && this_val==last_v){ $("#"+$(this).attr('id')).insertBefore($("#"+last_id)); return true; } last_v=this_val; last_id=$(this).attr('id'); $("#<?php echo $module['module_name'];?>_table tbody>tr ").each(function(){ if($(this).attr(attr_key)==undefined || $(this).attr('id')==this_id){return true;} //console.log(this_val+'>='+ parseFloat($(this).attr(attr_key))); if(this_val <= parseFloat($(this).attr(attr_key))){ $("#"+$(this).attr('id')).insertBefore($("#"+this_id)); } }); $(this).attr('each',1); }); $("#<?php echo $module['module_name'];?>_table tbody>tr ").removeAttr('each'); }else{ last_v=-999999.99; last_id=''; $("#<?php echo $module['module_name'];?>_table thead td .sorting_desc").attr('class','sorting'); $("#<?php echo $module['module_name'];?>_table thead td .sorting_asc").attr('class','sorting'); $(this).attr('class','sorting_asc'); $("#<?php echo $module['module_name'];?>_table tbody>tr ").each(function(index){ if($(this).attr(attr_key)==undefined){return true;} if($(this).attr('each')){return true;} this_line=$("#"+$(this).attr('id')); this_id=$(this).attr('id'); this_val=parseFloat($(this).attr(attr_key)); if(this_val==0){return true;} if(last_id!='' && this_val==last_v){ $("#"+$(this).attr('id')).insertBefore($("#"+last_id)); //$("#"+$(this).attr('id')).insertBefore($("#"+this_id)); return true; } last_v=this_val; last_id=$(this).attr('id'); $("#<?php echo $module['module_name'];?>_table tbody>tr ").each(function(){ if($(this).attr(attr_key)==undefined || $(this).attr('id')==this_id){return true;} //console.log(this_val+'>='+ parseFloat($(this).attr(attr_key))); if(this_val >= parseFloat($(this).attr(attr_key))){ $("#"+$(this).attr('id')).insertBefore($("#"+this_id)); } }); $(this).attr('each',1); }); $("#<?php echo $module['module_name'];?>_table tbody>tr ").removeAttr('each'); } return false; });
本页由《梦行文档》生成