EasyUI Forum
March 28, 2024, 02:41:53 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: Data grid misaligned when field name contains invalid char for CSS class name  (Read 4925 times)
samuel.fung
Newbie
*
Posts: 6


View Profile Email
« 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

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
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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.
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!