This is the working example.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Layout - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.min.js"></script>
<script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<div id="pg">pg</div>
<script type="text/javascript">
(function ($) {
$.fn.myeasyUI = function (opts) {
var ret = main(opts, this);
return ret;
};
function main(opts, $element) {
if (!opts || !opts.plugin) { return $element; }
$element[opts.plugin](opts.plugincontent);
if (opts.contentarray instanceof Object) {
$.each(opts.contentarray, function (i, o) {
if (opts.plugin == 'layout') {
$element[opts.plugin]('add', o);
var p = $element[opts.plugin]('panel', o.region);
var c = $('<div></div>').appendTo(p);
} else if (opts.plugin == 'panel') {
var c = $('<div></div>').appendTo($element);
// c.panel(o);
}
main(o, c);
// $element[opts.plugin]()
});
}
return $element;
}
$.fn.table = function (opts) {
var table = $('<div class="f-column"></div>').appendTo(this);
for(var i=0; i<opts.rows; i++){
var row = $('<div class="f-row"></div>').appendTo(table);
for(var j=0; j<opts.cols; j++){
var col = $('<div style="flex:1;overflow:hidden;position:relative;border:1px solid #ccc"></div>').appendTo(row);
var content = opts.tablecontent.filter(function (obj) { return obj.row === i && obj.col === j; })[0];
if (content){
col.css('height', content.height);
var p = $('<div></div>').appendTo(col);
p.css({
position:'absolute',
width:'100%',
height:'100%',
overflow:'auto'
});
var c = $('<div/>').appendTo(p);
main(content, c);
}
}
}
table.trigger('resize');
return this;
};
})(jQuery);
var data = { "total": 7, "rows": [{ "name": "Name", "value": "Bill Smith", "group": "ID Settings", "editor": "text" }, { "name": "Address", "value": "", "group": "ID Settings", "editor": "text" }, { "name": "Age", "value": "40", "group": "ID Settings", "editor": "numberbox" }, { "name": "Birthday", "value": "01/02/2012", "group": "ID Settings", "editor": "datebox" }, { "name": "SSN", "value": "123-456-7890", "group": "ID Settings", "editor": "text" }, { "name": "Email", "value": "bill@gmail.com", "group": "Marketing Settings", "editor": { "type": "validatebox", "options": { "validType": "email" } } }, { "name": "FrequentBuyer", "value": "false", "group": "Marketing Settings", "editor": { "type": "checkbox", "options": { "on": true, "off": false } } }] }
$('#pg').myeasyUI({
plugin: 'layout'
, plugincontent: { fit: true }
, contentarray: [{
region: 'center', title: 'center layout', split: true, plugin: 'table', plugincontent: {
rows: 3, cols: 3
, tablecontent: [
{ id: 'test1', row: 0, col: 1, height:'200px', plugin: 'panel', plugincontent: { fit: true, title: 'test1'},
contentarray: [
{plugin:'propertygrid',plugincontent:{fit:true,title:'propertygrid', data:data}}
]
}
, { id: 'test2', row: 1, col: 2, height:'100px', plugin: 'panel', plugincontent: { fit: false, height: 100, width: 300, title: 'test2' } }
, { id: 'test3', row: 2, col: 0, height:'200px', plugin: 'propertygrid', plugincontent: { title: 'test3', fit: true, showGroup: true, data: data } }
]
}
}]
});
</script>
</body>
</html>