EasyUI Forum
October 16, 2025, 07:25:28 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: try to run the code and a bug will appear in Nested Subgrid and AppendRow New  (Read 15007 times)
Jeffrey AnnSheila
Newbie
*
Posts: 21


View Profile Email
« on: June 13, 2016, 07:56:21 AM »

Hi, I find a bug in the frame, demonstrating here through the codes below.  When you don't  expand the row in main grid, you can add a new row correctly, but when you expand the row and make the nested subgrid appear, you can't add the new row properly.
here is codes:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Loading nested subgrid data - jQuery EasyUI Demo</title>
        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
        <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.min.js"></script>
        <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-detailview.js"></script>
   <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script>
    </head>
    <body>
        <h2>Loading nested subgrid data</h2>
        <p>Click the expand button to expand row and view subgrid.</p>

        <table id="dg"></table>
        <script type="text/javascript">
            var conf = {
                options:{
                    fitColumns:true,
                    toolbar : [ {
                    iconCls : 'icon-add',
                    text : 'new',
                    handler : function() {
                       $('#dg').edatagrid('addRow');


                    }
                 }, '-', {
                    iconCls : 'icon-remove',
                    text : 'del',
                    handler : function() {
                       commitCase = true;
                       $(this).datagrid('getSelfGrid').edatagrid('destroyRow');

                    }
                 }, '-', {
                    iconCls : 'icon-save',
                    text : 'save',
                    handler : function() {
                       commitCase = true;
                       $(this).datagrid('getSelfGrid').edatagrid('saveRow');
                    }
                 }, '-', {
                    iconCls : 'icon-undo',
                    text : 'cancel',
                    handler : function() {
                       commitCase = true;
                       $(this).datagrid('getSelfGrid').edatagrid('cancelRow');
                    }
                 } ],
                    columns:[[
                        {field:'company',title:'Company Name',width:200},
                        {field:'contact',title:'Contact Name',width:200},
                        {field:'country',title:'Country',width:200}
                    ]],
                    data:[
                        {company:'Speed Info',contact:'Minna John',country:'Sweden'}
                    ]
                },
                subgrid:{
                    options:{
                        fitColumns:true,
                        foreignField:'companyid',
                        columns:[[
                            {field:'orderdate',title:'Order Date',width:200},
                            {field:'shippeddate',title:'Shipped Date',width:200},
                            {field:'freight',title:'Freight',width:200}
                        ]],
                        data:[
                            {orderdate:'08/23/2012',shippeddate:'12/25/2012',freight:9734},
                            {orderdate:'08/23/2012',shippeddate:'12/25/2012',freight:9734},
                            {orderdate:'08/23/2012',shippeddate:'12/25/2012',freight:9734}
                        ]
                    },
                    subgrid:{
                        options:{
                            fitColumns:true,
                            foreignField:'orderid',
                            columns:[[
                                {field:'price',title:'Unit Price',width:200,align:'right'},
                                {field:'quantity',title:'Quantity',width:200,align:'right'},
                                {field:'discount',title:'Discount',width:200,align:'right',formatter:function(value){
                                    return value*100+'%'
                                }}
                            ]],
                            data:[
                                {price:923,quantity:2312,discount:0.2}
                            ]
                        },
                        subgrid:{
                            options:{
                                fitColumns:true,
                                foreignField:'pid',
                                singleSelect:true,
                                columns:[[
                                    {field:'pnumber',title:'Product Number',width:200},
                                    {field:'pname',title:'Product Name',width:200},
                                    {field:'supplier',title:'Supplier',width:200}
                                ]],
                                data:[
                                    {pnumber:'00100823',pname:'Canon PowerShot A1300',supplier:'Canon'},
                                    {pnumber:'12023423',pname:'Cisco RV110W-A-NA-K9',supplier:'Cisco'},
                                    {pnumber:'82312393',pname:'Nikon COOLPIX L26 16.1 MP',supplier:'Nikon'}
                                ]
                            }
                        }
                    }
                }
            };

            $(function(){
                $('#dg').edatagrid({
                    title:'DataGrid - Nested SubGrid',
                    width:700,
                    height:300
                }).datagrid('subgrid', conf);
            });
        </script>


    </body>
    </html>
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: June 13, 2016, 08:14:11 AM »

Please try to set the 'autoUpdateDetail' property to false for the mast grid.
Code:
var conf = {
    options:{
        fitColumns:true,
        autoUpdateDetail:false,
        toolbar : [ {
        iconCls : 'icon-add',
        text : 'new',
        handler : function() {
           $('#dg').edatagrid('addRow');
        }
//...
Logged
Jeffrey AnnSheila
Newbie
*
Posts: 21


View Profile Email
« Reply #2 on: June 13, 2016, 08:27:56 AM »

i add the 'autoUpdateDetail:false', but the problem is same. please run the code and kill the bug, sir.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #3 on: June 13, 2016, 08:33:30 AM »

Please look at this example http://code.reloado.com/ulitit/edit#preview. It works fine.
Logged
Jeffrey AnnSheila
Newbie
*
Posts: 21


View Profile Email
« Reply #4 on: June 13, 2016, 08:48:28 AM »

i try running in safari and firefox, but it doesn't work fine. but in Reloado.com it works fine.
Logged
Jeffrey AnnSheila
Newbie
*
Posts: 21


View Profile Email
« Reply #5 on: June 13, 2016, 07:17:59 PM »

After i update to the 3 files: jquery-easyui-1.4.5 , jquery-easyui-datagridview, jquery-easyui-edatagrid, the codes work fine now. Thank you friend. Roll Eyes Cheesy
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!