最近遇到了一个问题,是关于easyui数据表格的显示和隐藏的,一般显示元素可以通过dispaly:block(或show())和display:none (hide())控制显示隐藏的
但是这个easyui中datagrid有点特别:
具体实现 给table中class="easyui-datagrid" ,外面包一层div,给class="easyui-panel"
<div style="width: 600px;height: 600px;margin: 50px auto;" class="easyui-panel"closed="true" id="box">
<table id="dg" class="easyui-datagrid"></table>
</div>
注意:在外层div中closed="true" 是为了控制初始化的时候让表格消失 (这里不能使用display:none)
$("#box").panel('open')和$("#box").panel('close');来控制显示和隐藏
案例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="