working jqGrid Example
by KevinGabbert
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css">
<link rel="stylesheet" href="http://trirand.com/blog/jqgrid/themes/ui.jqgrid.css">
<script src="http://trirand.com/blog/jqgrid/js/i18n/grid.locale-en.js"></script>
<script src="http://trirand.com/blog/jqgrid/js/jquery.jqGrid.min.js"></script>
<table id="rulesDefTable"></table>
JavaScript
/* PieceDef Grid Test for ChessMangler */
var _rulesDef = {
"ChessConfig": {
"version": "CM2 pre-alpha",
"game": "Chess",
"Board": {
"twoD": {
"type": "tetragon",
"columns": "8",
"rows": "8",
"SpotDef": {
"coordinate" : "-1",
"length" : "100",
"width" : "100"
}
}
},
"PieceDefs": [
{
"name": "BlackKnightLeft",
"startingSpot": "A1",
"coordinate": "spot-1-2",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bn.png",
"Movement": [
{"condition": "Immobilized"},
{"condition": "blahblhablaha"},
{"condition": "gggggggggggg"}
]
},
{
"name": "BlackBishopLeft",
"startingSpot": "A1",
"coordinate": "spot-1-3",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bb.png",
"Movement": [
{"condition":"Not own Piece"},
{"condition":"Replace Opposing Piece"}
]
}
]
}
}
$("#rulesDefTable").jqGrid({
datatype: "local",
height: 150,
colNames: ['condition'],
colModel: [
{
name: 'condition',
index: 'condition',
width: 180
}],
caption: "Test Array"
});
for (var i = 0; i <= _rulesDef.ChessConfig.PieceDefs.length; i++) {
if(_rulesDef.ChessConfig.PieceDefs[i].name == "BlackBishopLeft") {
var movements =...