deselect.html
<body>
<div id="flexGrid"></div>
<input type="button" id="check" value="selectedRow"/>
<script th:inline="javascript">
/*<![CDATA[*/
$( function() {
var prevSelRow = -1;
var grid = new wijmo.grid.FlexGrid('#flexGrid');
grid.initialize({
autoGenerateColumns: false,
columns: [
{ header: '番号', binding: "code", width:200},
],
selectionMode : 'Row',
isReadOnly : true,
allowSorting : false,
});
grid.itemsSource = [
{code:"01"},
{code:"02"},
{code:"03"},
{code:"04"},
{code:"05"},
];
grid.collectionView.moveCurrentToPosition(-1);
grid.hostElement.addEventListener("click", function (e) {
var ht = grid.hitTest(e.pageX, e.pageY);
if ( ht.cellType === wijmo.grid.CellType.Cell ||
ht.cellType === wijmo.grid.CellType.RowHeader) {
if ( prevSelRow === ht.row ) {
grid.collectionView.moveCurrentToPosition(-1);
prevSelRow = -1;
} else {
prevSelRow = ht.row;
}
}
});
$("#check").click(function(){
if ( grid.selectedRows.length > 0 ) {
alert(grid.getCellData(grid.selectedRows[0].index, 0));
} else {
alert("NOT SELECTED");
}
});
});
/*]]>*/
</script>
</body>