EasyUI Forum

General Category => Bug Report => Topic started by: samuel.fung on April 23, 2017, 06:39:08 PM



Title: Data grid misaligned when field name contains invalid char for CSS class name
Post by: samuel.fung on April 23, 2017, 06:39:08 PM
Code:
$("#dg").datagrid({
columns: [[{title: "name", field: "name", width: 100},
  {title: "height(cm)", field: "height(cm)", width: 50},
  {title: "rank", field: "rank", width: 50}]],
data: [{name: "Alan", "height(cm)": 180, rank: 1},
  {name: "Ben", "height(cm)": 175, rank: 2}]
});

... is rendered to
(https://www.jeasyui.com/forum/index.php?action=dlattach;topic=6645.0;attach=1465)
Code:
<td class="" field="height(cm)">
<div class="datagrid-cell datagrid-cell-c2-height(cm)">
<span>height(cm)</span>
<span class="datagrid-sort-icon"></span>
</div>
</td>

The class name "datagrid-cell-c2-height(cm)" is invalid, so it fails to set the width.
http://stackoverflow.com/questions/448981/which-characters-are-valid-in-css-class-names-selectors


Title: Re: Data grid misaligned when field name contains invalid char for CSS class name
Post by: stworthy on April 23, 2017, 07:28:36 PM
The '(' and ')' characters are not allowed in the field names. Please use 'height_cm' or 'height.cm' instead.