working jqGrid Example
by KevinGabbert
HTML
<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>
CSS
.ui-jqgrid tr.jqgrow td {
font-weight: normal;
overflow: hidden;
white-space: pre;
height: 22px;
padding: 0 2px 0 2px;
border-bottom-width: 1px;
border-bottom-color: inherit;
border-bottom-style: solid;
/* background-color:#D3D3D3; */
}
.ui-jqgrid tr.jqgfirstrow td {
padding: 0 2px 0 2px;
border-right-width: 1px;
border-right-style: solid;
}
.ui-jqgrid .ui-jqgrid-sortable {
cursor:pointer;
background-color:#b0c4de;
}
JavaScript
/* PieceDef Grid Test for ChessMangler */
//var arr = [1, 2, [3, 4], 5];
//alert (arr[2][1]);
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": "YoMomma",
"startingSpot": "A1",
"coordinate": "item1",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bn.png"
},
{
"name": "BlackKnightLeft",
"startingSpot": "A1",
"coordinate": "item2",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bn.png",
"Movement": [
{"condition": "Immobilized"},
{"condition": "blahblhablaha"},
{"condition": "gggggggggggg"}
]
},
{
"name": "TestPiece",
"startingSpot": "A1",
"coordinate": "item3",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bb.png",
"Movement": [
{"condition":"This is a condition"},
]
},
{
"name": "BlackBishopLeft",
"startingSpot": "A1",
"coordinate": "item4",
"player": "Black",
"imageName": "images/chessPieces/Chess.Merida/bb.png",
"Movement": [
{"condition":"Not own Piece"},
{"condition":"Replace Opposing Piece"}
...