EasyUI Forum
September 13, 2025, 06:50:10 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: Combogrid header column width  (Read 12721 times)
rob
Newbie
*
Posts: 8


View Profile
« on: December 04, 2013, 02:15:02 AM »

The header columns in a combo grid initially have a wrong size (very small) when no width is given in the column definition (with fitColumns = true).
After a reload data or when using the pagination controls the header columns are resized to fit the content correctly.

This can be shown with the combogrid demo (http://jeasyui.com/demo/main/index.php?plugin=ComboGrid&theme=default&dir=ltr&pitem=) by removing the width attributes as follows:
Code:
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Basic ComboGrid - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="easyui.css">
    <link rel="stylesheet" type="text/css" href="icon.css">
    <link rel="stylesheet" type="text/css" href="../demo.css">
    <script type="text/javascript" src="jquery-1.10.2.js"></script>
    <script type="text/javascript" src="jquery.easyui.min.js"></script>
    </head>
    <body>
    <select class="easyui-combogrid" style="width:400px" data-options="
    panelWidth: 500,
    idField: 'itemid',
    textField: 'productname',
    url: 'datagrid_data1.json',
    method: 'get',
    showFooter: true,
    columns: [[
    {field:'itemid',title:'Item ID'},
    {field:'productname',title:'Product'},
    {field:'listprice',title:'List Price',align:'right'},
    {field:'unitcost',title:'Unit Cost',align:'right'},
    {field:'attr1',title:'Attribute'},
    {field:'status',title:'Status',align:'center'}
    ]],
    fitColumns: true
    ">
   
    </select>
    </body>
    </html>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: December 06, 2013, 04:42:17 AM »

To solve this issue, please call 'autoSizeColumn' method for datagrid when drop-down combo panel.
Code:
<select class="easyui-combogrid" style="width:400px" data-options="
//...
onShowPanel:function(){
$(this).combogrid('grid').datagrid('autoSizeColumn');
}
">
</select>

Or download the updated datagrid plugin from http://www.jeasyui.com/easyui/plugins/jquery.datagrid.js and include to your page.
Logged
rob
Newbie
*
Posts: 8


View Profile
« Reply #2 on: December 17, 2013, 12:54:12 AM »

works like a charm, thx a lot...
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!