Hello guys, I’m new DHTMLX. But it seems a very good project! I’m getting to grips with the basics. I wondered where I’m wrong in the example that I enclose. I can not bring up a grid on a form. Someone tells me how to do?
Thank you
<!DOCTYPE html>
<html>
<head>
<title>Form and window</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<link rel="stylesheet" type="text/css" href="dhtmlx/codebase/fonts/font_roboto/roboto.css"/>
<link rel="stylesheet" type="text/css" href="dhtmlx/codebase/dhtmlx.css"/>
<script src="dhtmlx/codebase/dhtmlx.js"></script>
<script type="text/javascript" src="jquery-2.0.2.min.js"></script>
<style>
div#vp {
height: 600px;
border: 1px solid #dfdfdf;
}
</style>
<script>
var myForm, formData;
var dhxWins, w1;
function doOnLoad() {
data={
rows:[
{ id:1001,
data:[
"100",
"A Time to Kill",
"John Grisham"
] },
{ id:1002,
data:[
"1000",
"Blood and Smoke",
"Stephen King",
] }
]
}
formData = [
{type: "settings", labelWidth: 130, inputWidth: 170},
{type: "input", label: "Full Name", value: "fra"},
{type: "input", label: "Email", value: "test@gmail.com"},
{type: "container", name: "myGrid", label: "Select Product 1", inputWidth: 330, inputHeight: 200}
];
dhxWins = new dhtmlXWindows();
dhxWins.attachViewportTo("vp");
w1 = dhxWins.createWindow("w1", 10, 10, 700, 300);
w1.denyResize();
myForm = w1.attachForm(formData, true);
myForm.attachEvent("onButtonClick", function(name){ btnOKclick(); });
mygrid = new dhtmlXGridObject('myGrid');
mygrid.setImagePath("dhtmlx/codebase/imgs/");
mygrid.setSkin("dhx_skyblue");
mygrid.setHeader("Sales, Book Title, Author");
mygrid.setInitWidths("70,250,*")
mygrid.setColAlign("right,left,left")
mygrid.setColTypes("dyn,ed,ed");
mygrid.setColSorting("int,str,str")
mygrid.init();
mygrid.setSkin("modern");
//mygrid.load("grid.json","json");// JSON containing config block together with data
mygrid.parse(data,"json");
}
</script>
</head>
<body onload="doOnLoad();">
<div id="vp"></div>
</body>
</html>