zoukankan      html  css  js  c++  java
  • EasyUI datagird 排序 按数字类型的问题

    easyui datagird 默认显示的数据都是字符, 对要数字列进行排序规则,需要自定义排序规则
    如果按字符排序 27竟然小于4 这不是我们想要的。
    解决方案
    <table id='grid'class='easyui-datagrid' style='1100px;height:430px' 
           url='Ajax-index.php?module=<{$module_name}>&action=Ajax_ReportView_Agent_Call_Report_Select&assigned_user_id=<{$assigned_user_id}>'  
          title='列表' iconCls='icon-table'  rownumbers='true' fitColumns='true' singleSelect='true' toolbar='#toolbar'  remoteSort='false'>  
    </table>

    <script type='text/javascript'> //按数字类型排序 自定义排序 function sort_int(a,b){ if(a.length > b.length) return 1; else if(a.length < b.length) return -1; else if(a > b) return 1; else return -1; }
    //显示列 $(
    '#grid').datagrid({ columns: [[ {field:'user_name',title:'坐席工号',20,align:'center'}, {field:'first_name',title:'坐席员',20,align:'center'}, {field:'call_count',title:'电话总量',20,align:'center', sortable:true,sorter:sort_int}, {field:'callout_count',title:'呼出数量',20,align:'center' , sortable:true,sorter:sort_int}, {field:'callin_count',title:'呼入数量',20,align:'center', sortable:true,sorter:sort_int }, {field:'callout_time_len',title:'呼出总时长(秒)',20,align:'center', sortable:true,sorter:sort_int}, {field:'callin_time_len',title:'呼入总时长(秒)',20,align:'center', sortable:true,sorter:sort_int}, {field:'talk_time_len',title:'通话总时长(秒',20,align:'center', sortable:true,sorter:sort_int}, {field:'avg_talk_len',title:'平均通话时长(秒)',20,align:'center', sortable:true,sorter:sort_int}, {field:'talk_count',title:'接通总量',20,align:'center', sortable:true,sorter:sort_int}, {field:'talk_ratio',title:'接通率',20,align:'center'} ]] }); </script>


     

  • 相关阅读:
    div中子div在firefox ie 水平居中对齐
    Access数据库自定义连接字符串(详细有图百度文档)
    ASP页面乱码
    国内开源asp.netCMS汇总
    sql 2005
    卡巴斯基授权key导入方式方法及其导入key基本原理
    关于SqlServer服务无法启动的症状分析和解决方法
    js下流媒体的在线播放
    用JS+vml作三维报表
    了解嵌入式数据库(sqlite,firebird)
  • 原文地址:https://www.cnblogs.com/hailexuexi/p/4651133.html
Copyright © 2011-2022 走看看