easyui-datagrid中的表结构(列)赋给另一个 easyui-datagrid组件
页面上有两个 easyui-datagrid 组件
grid 用于显示
grid_toexcel 用于导出
目的 将 grid 克隆至 grid_toexcel 使 grid_toexcel 与 grid 的表结构完(列)全一样,但数据并不克隆
html
<table id='grid' class='easyui-datagrid' style='width:1250px;min-height:450px' title='列表' iconCls='icon-table' pagination='true' rownumbers='true' fitColumns='true' singleSelect='true' toolbar='#toolbar' > <!-- rownumbers='true' fitColumns='true' singleSelect='true' toolbar='#toolbar' remoteSort='false'> 不分页 --> <thead> <tr> <th field='agent_name' width='25'align='center' sortable='true' >坐席工号</th> <th field='user_name' width='25'align='center' sortable='true' >坐席员</th> <th field='start_time' width='40'align='center' sortable='true' >开始时间</th> <th field='stop_time' width='40'align='center' sortable='true' >结束时间</th> <th field='time_len' width='20'align='center' sortable='true' >时长</th> <th field='time_len_s' width='20'align='center' sortable='true' >时长(秒)</th> <th field='status' width='20'align='center' sortable='true' >状态</th> <th field='description' width='80'align='center' sortable='true' >描述</th> </tr> </thead> </table> <div id='div_toexcel' class='easyui-panel' closed='true'><!-- 用于导出 --> <table id='grid_toexcel' class='easyui-datagrid'> </table> </div>
js
//var cols = $('#grid').datagrid('getColumnFields'); //获取所有列名 //将grid的表结构(列名)赋给grid_toexcel var cols=$('#grid').datagrid('options').columns; //获取所有列的json对象 //console.log(cols[0]); $('#grid_toexcel').datagrid({columns:[cols[0]]}).datagrid("reload");
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
2022-06-14 帝国CMS 标签 showclasstemp
2022-06-14 帝国CMS 标签 phomenews
2022-06-14 帝国CMS 标签 ecmsinfo
2022-06-14 帝国CMS 标签 listsonclass
2018-06-14 html input 文本框 只能输入数字,包含输小数点.