jquery easyui的treegrid的控制

来源:互联网 发布:centos minimal 桌面 编辑:程序博客网 时间:2024/05/17 22:16

datagrid和treegrid其中列的formatter很有作用,可以得到你想要的任何内容:

例:

<table class="easyui-treegrid" id="tg" data-options="
  url:'/Manage/Ajax.aspx', 
  idField: 'id',
  treeField: 'name',
  fitColumns:true, 
  striped:true, 
  onLoadSuccess:function(row,data){
     $('#tg').treegrid('collapseAll');
}">
<thead>
  <tr>
    <th data-options="field:'name',width:180">名称</th>
    <th data-options="field:'districtName',width:180">所属行政区</th>
    <th data-options="field:'parentName',width:180">上级公司</th>
    <th data-options="field:'address',width:180">地址</th>
    <th data-options="field:'contact',width:180">联系人</th>
    <th data-options="field:'_mobile',width:180">电话</th>
    <th data-options="field:'adddate',width:180,editor:'datebox',
      formatter:formatDate">创建时间</th>
    <th data-options="field:'id',
      formatter:formatter">操作</th>
  </tr>
</thead>
</table>

<script>

  //加载超链接
  var formatter = function (value, row, index) {
    var linkstr = "<a href='#' onclick='return window.parent.ShowEditCorpListDialog(" + value + ");'>编辑</a>";
    return linkstr;
  }

//格式化日期
var formatDate = function (value, row, index) {
  value.replace(/Date\([\d+]+\)/, function (a) { eval('d = new ' + a) });
  return new Date(d).format("yyyy-MM-dd");
}
</script>

 

公司官网:http://www.heryit.cn

淘宝店铺:https://shop141215887.taobao.com/?qq-pf-to=pcqq.group

0 0
原创粉丝点击