用easyui一个页面展示多个datagrid

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%@ include file="/commons/common_js.jsp" %>
    <meta http-equiv="X-UA-Compatible" content="edge"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>****</title>
    <script type="text/javascript">
        var dataGrid;

        $(function () {
            getDisassemblyDate();
            getDate();
        });
        function scanInvData(){
            var code = event.keyCode;
             if(code == 13){
                 var inv = $("#Inv").val();
                 getInvDate(inv);
            }
        }
        
        function getDisassemblyDate(){
            dataGrid = $('#dataGrid').datagrid({
                url: '${path}/*',
                fit: true,
                striped: true,
                rownumbers: false,
                idFeild: 'id',
                pagination: true,
                singleSelect: true,
                sortOrder: 'ASC',
                pageSize: 10,
                pageList: [10, 20, 50, 100, 200, 300],
                columns:
                        [[
                            { field:'ck',checkbox:true },
                                    {
                                        field: 'materialId',
                                        title: '物料INV',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'afterQty',
                                        title: '数量',
                                        width: 100,
                                        sortable: true
                                    }
                        ]],
                        toolbar: '#toolbar'
            });
            
        }
        
        
        function getDate(){
            dataGrid = $('#dataGrid2').datagrid({
                url: '${path}/*',
                fit: true,
                striped: true,
                rownumbers: true,
                idFeild: 'id',
                pagination: true,
                singleSelect: true,
                sortOrder: 'ASC',
                pageSize: 10,
                pageList: [10, 20, 50, 100, 200, 300],
                columns:
                        [[
                            { field:'ck',checkbox:true },
                                    {
                                        field: 'inv',
                                        title: '原始物料Id',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'qty',
                                        title: '原始数量',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'afterInv',
                                        title: '拆分后Id',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'afterQty',
                                        title: '数量',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'addUser',
                                        title: '操作员',
                                        width: 100,
                                        sortable: true
                                    },
                                    {
                                        field: 'addTime',
                                        title: '操作时间',
                                        width: 100,
                                        sortable: true
                                    },
                        ]],toolbar:'#toolbar2'
                       
            });
            
        }
        function addFun() {
            parent.$.modalDialog({
                id: 'addDialog',
                title: '添加materialDisassembly',
                width: 800,
                height: 500,
                href: '${path}/*',
                buttons: [{
                    text: '保存',
                    iconCls: 'icon-save',
                    handler: function () {
                        parent.$.modalDialog.openner_dataGrid = dataGrid;//因为添加成功之后,需要刷新这个dataGrid,所以先预定义好
                        var f = parent.$.modalDialog.handler.find('#materialDisassemblyInsertBtn');
                        f.click();
                    }
                }, {
                    text: '关闭',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        parent.$('#addDialog').dialog('close');
                    }
                }]
            });
        }
        function getInvDate(inv){
            $.ajax({
                type:'get',
                url:'${path}/*',
                cache:false ,
                dataType:'json',
                data:{inv:inv},
                success:function(result){
                    
                    if (result.obj){
                    }else{
                        parent.$.messager.alert("操作提示",result.msg,"warning");
                    }
                },
                error: function () {
                    alert("查询错误");
                }
            });
        }
            
        function searchFun() {
            var keywords = $('#keywords').val();
            dataGrid.datagrid('load', {keywords: keywords});
        }

        function cleanFun() {
            $('#keywords').val('');
            dataGrid.datagrid('load', {});
        }
    </script>
</head>
<body class="easyui-layout" data-options="fit:true,border:false">

<div style="height: 60%;width: 100%;">
    <table id="dataGrid" data-options="fit:true,border:false"></table>
</div>
<div id="tt" class="easyui-tabs" style="width:100%;height:90%;"fit="true" border="true">   
    <div title="物料拆分查询页面:" >
        <div style="height: 35%;overflow:auto;">
            <table id="dataGrid2" data-options="fit:true,border:false"></table>
        </div>
    </div>   
</div>
<div id="toolbar" style="display: none;">
    <br>
    <hr>
    <span  style="margin-left:20px;">物料INV:</span>&nbsp;&nbsp;&nbsp;&nbsp;
    <input class="easyui-textbox" name="inv" id="inv" type="text" class="easyui-validatebox"
           style="width: 150px;height: 25px;" οnkeydοwn="scanInvData()">&nbsp;&nbsp;&nbsp;&nbsp;
    <span  style="width:300px;height: 25px;" name="materialInfomation" id="materialInfomation" >物料信息显示区,ID,物料编号,物料名称,状态,数量</span>
    <br>
    <br>
     <span  style="margin-left:20px;">拆分的个数:</span>
    <input class="easyui-textbox" name="disassemblyNumber" id="disassemblyNumber" type="text" class="easyui-validatebox"
           style="width: 150px;height: 25px;">&nbsp;&nbsp;&nbsp;&nbsp;
    <span >拆分的数量</span>
    <input class="easyui-textbox" name="AfterQty" id="AfterQty" type="text" class="easyui-validatebox"
           style="width: 150px;height: 25px;">&nbsp;&nbsp;&nbsp;&nbsp;
     <a id="printBtn" href="javascript:void(0)" οnclick="searchFun()" class="easyui-linkbutton"
       iconCls="icon-print">拆分并打印条码</a>
    <br>
    <br>
    <span  style="margin-left:20px;width:300px;height: 25px;" >数据设置错误,拆分不成功,请重新设置拆分数量/拆分成功,结果如下</span>
    <hr>
</div>
<div id="toolbar2" style="display: none;">
    <span style="margin-left:20px;">起始时间:</span>&nbsp;&nbsp;&nbsp;&nbsp;
   <input id="addTime" name="addTime" style="width:180px;height:25px;" type="text" class="easyui-datetimebox" data-options="editable:false,required:true" /> &nbsp;&nbsp;&nbsp;&nbsp;
    <span>截至时间:</span>
   <input id="endTime" name="endTime" style="width:180px;height:25px;"  type="text" class="easyui-datetimebox" data-options="editable:false,required:true" /> &nbsp;&nbsp;&nbsp;&nbsp;
    <span>物料编号/名称:</span>
   <input class="easyui-textbox" name="keyword" id="keyword" type="text" class="easyui-validatebox"
           style="width: 150px;height: 25px;">&nbsp;&nbsp;&nbsp;&nbsp;
   <span>物料ID:</span>
   <input class="easyui-textbox" name="inv" id="inv" type="text" class="easyui-validatebox"
           style="width: 150px;height: 25px;">&nbsp;&nbsp;&nbsp;&nbsp;
   <a id="searchBtn" href="javascript:void(0)" οnclick="searchFun()" class="easyui-linkbutton"
            data-options="iconCls:'icon-search'">查询</a>
</div>
</body>
</html>

 

 

思路,定义两个toobar# 如果有需要,定义两个table必须,


datagrid
分别调用渲染即可

 

写在最后,本人只是为自己做记录,如有需要以及不解处请留言,我会及时回复

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值