EasyUI Forum

General Category => Bug Report => Topic started by: Kevin on January 22, 2013, 02:26:12 PM



Title: Multiline datagrid header only shows one line in 1.3.2
Post by: Kevin on January 22, 2013, 02:26:12 PM
In all previous versions, it was possible to create a multilined datagrid header by just inserting a <br> tag in the title. Multiline headers are extremely helpful if you have many columns with 'long' heading names. Thus splitting them up into 2 lines will technically halve the width of the table. The following code creates a 2 line header in V1.3.1, but you only see the 1st line in V1.3.2
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test</title>
<link href="http://www.jeasyui.com/easyui/themes/default/easyui.css" type="text/css" rel="stylesheet" />
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
   $('#test').datagrid({
      fit: true,
      columns: [[
         { field: 'col1', title: 'Col 1<br>Next',width: 100},
         { field: 'col2', title: 'Col 2', width: 100}
      ]]
   });
});
</script>
</head>
<body>
   <table id="test"></table>
</body>
</html>
This has been tested with IE,FF and Chrome - same results. I've also tried creating the table with HTML which also only displays 1 line in the header.


Title: Re: Multiline datagrid header only shows one line in 1.3.2
Post by: stworthy on January 22, 2013, 07:05:01 PM
The header cells and body cells have the same height in version 1.3.2. This makes the datagrid looks more nice. To enable multi-line header, please include the <style> below on the page.
Code:
<style type="text/css">
.datagrid-header .datagrid-cell{
line-height:normal;
height:auto;
}
</style>


Title: Re: Multiline datagrid header only shows one line in 1.3.2
Post by: Kevin on January 23, 2013, 01:45:29 AM
Thanks very much stworthy, works a treat. I just wish I was half as clever as you :)