Skip to content

Instantly share code, notes, and snippets.

@funkytaco
Last active December 26, 2015 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkytaco/7105052 to your computer and use it in GitHub Desktop.
Save funkytaco/7105052 to your computer and use it in GitHub Desktop.
openJS cellTypes not working
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css"/>
<link rel="stylesheet" href="/grid.css" title="openJsGrid"/>
<script src="/jquery.js" type="text/javascript"></script>
<script src="/root.js" type="text/javascript"></script>
<script src="/grid.js" type="text/javascript"></script>
<style>
.cell.warning {
background-color:red;
color: white;
}
</style>
</head>
<body>
<h2>Alarms</h2>
<table class="grid alarms" action="ajax.php">
<tr>
<th col="alarmtype">Alarm Type</th>
<th col="alert">Alert</th>
</tr>
</table>
<script>
$(function(){
var $grid = $(".alarms").grid({
editing: true,
cellTypes : {
"alert": function(value, columnOpts, grid) {
console.log(value); //undefined
console.log(columnOpts); //undefined
console.log(grid); //undefined
return {
cellClass: value,
cellValue: value
}
}
}
})
}).on("rowClick",function(e, $rows,rowData) {
console.log("rowClick",$rows,rowData);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment