EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: kitty on May 06, 2013, 06:54:36 AM



Title: DataGrid in XHTML File
Post by: kitty on May 06, 2013, 06:54:36 AM
Hello,
The code is:

testDataGridInXHTML.xhtml:
Code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" ></meta>
<title>Title goes here</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="demo.css" />
<script type="text/javascript" src="../jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#test").datagrid({
title : "test",
height : 199,
width : 788,
url:'datagrid_data.json',
columns:[[
//{field:"name",title:'le',width:150},
{field:"addr", title:'le', width:150}
]]
});
});
</script>
</head>

<body>
test
<table id="test" ></table>
</body>
</html>

datagrid_data.json:
Code:
{                                                      
"total":239,                                                     
"rows":[                                                         
{"code":"001","name":"Name 1","addr":"Address 11","col4":"col4 data"},         
{"code":"002","name":"Name 2","addr":"Address 13","col4":"col4 data"},         
{"code":"003","name":"Name 3","addr":"Address 87","col4":"col4 data"},         
{"code":"004","name":"Name 4","addr":"Address 63","col4":"col4 data"},         
{"code":"005","name":"Name 5","addr":"Address 45","col4":"col4 data"},         
{"code":"006","name":"Name 6","addr":"Address 16","col4":"col4 data"},         
{"code":"007","name":"Name 7","addr":"Address 27","col4":"col4 data"},         
{"code":"008","name":"Name 8","addr":"Address 81","col4":"col4 data"},         
{"code":"009","name":"Name 9","addr":"Address 69","col4":"col4 data"},         
{"code":"010","name":"Name 10","addr":"Address 78","col4":"col4 data"}     
]                                                         
}

In FireFox it goes wrong:
SyntaxError: An invalid or illegal string was specified

Why {field:"addr", title:'le', width:150} can work in .HTML,
but cannot work in .XHTML?

Please help me,Thanks!!!


Title: Re: DataGrid in XHTML File
Post by: Punkerr on May 06, 2013, 07:06:46 AM
Try: {field:'addr', title:'le', width:150}


Title: Re: DataGrid in XHTML File
Post by: kitty on May 06, 2013, 06:04:13 PM
Dear Punkerr ,

I change {field:"addr", title:'le', width:150} to {field:'addr', title:'le', width:150} in XHTML file,
but it can not work also.

Please help me,Thanks!!!

 
 


Title: Re: DataGrid in XHTML File
Post by: kitty on May 06, 2013, 08:55:54 PM
jquery.js:

tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
-->
tmp.innerHTML = "&nbsp;";

"&nbsp;" in xhtml file is not allowed,
why?
Please help me! Thanks!


Title: Re: DataGrid in XHTML File
Post by: kitty on May 06, 2013, 09:13:43 PM
In line 6469 of jquery-1.9.1.js,
it is:
Code:
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
I change it to:
Code:
if(elem == "&nbsp;"){
tmp.innerHTML = " ";
}else{
tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2];
}
It can work!
anybody can give me a better solution?
Thanks!!! :)


Title: Re: DataGrid in XHTML File
Post by: Punkerr on May 07, 2013, 07:22:25 AM
To use &nbsp; in XML use the following entity: &#160;