EasyUI Forum
April 26, 2024, 02:47:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: datagrid issue  (Read 5658 times)
felixHo
Newbie
*
Posts: 4


View Profile Email
« on: November 13, 2018, 06:35:27 PM »

Please try below code. The datadrid only show one time, next time it doesn't work. Version 1.5.1 has no this issue.
<script>
      function Opentest(){
         InitGrid();
         $('#dialog').dialog('open').dialog('setTitle', 'Test');
      }
      
      function InitGrid(){
         $('#grid').datagrid({
            singleSelect:true,
            collapsible:true,
            //url:'datagrid_data1.json',
            //method:'get',
            columns: [[
               { field: 'itemid', title: 'Item ID' },
               { field: 'productid', title: 'Product' },
               { field: 'listprice', title: 'List Price' },
               { field: 'unitcost', title: 'Unit Cost' },
               { field: 'attr1', title: 'Attribute' },
               { field: 'status', title: 'Status' },
               ]],
            });
            
         $('#grid').datagrid('loadData', { total: 0, rows: [] });
         //GridAppend();
      }
   </script>
</head>
<body>
   <div style="padding:5px 0;">
      <a href="javascript:Opentest();" class="easyui-linkbutton" data-options="iconCls:'icon-add'">Add</a>
   </div>

   <div id="dialog" class="easyui-dialog" style="width: 1060px; padding: 1px; overflow-y:scroll; height:auto;" closed="true" resizable="true" modal="true" data-options="iconCls: 'icon-batchadd', buttons: '#dlg-buttons'">
      <form id="form" method="post" novalidate="novalidate">
         <table id="grid" class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px"></table>
      </form>
   </div>
</body>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: November 14, 2018, 12:24:09 AM »

You should initialize the datagrid after opening the dialog.
Code:
$('#dialog').dialog('open').dialog('setTitle', 'Test');
InitGrid();
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!