Skip to content

Instantly share code, notes, and snippets.

@optikalefx
Created October 31, 2012 18:17
Show Gist options
  • Save optikalefx/3988817 to your computer and use it in GitHub Desktop.
Save optikalefx/3988817 to your computer and use it in GitHub Desktop.
Adding Columns / Buttons
<script>
$(function(){
var $grid = $(".demo6").grid({
editing: true
}).on("loadComplete",function(e) {
// the add column
$(this).grid("addColumn","Add",{
width: 60,
insertAt: "end", // index | column | "end" | "start"
header : "Action",
cellClass : "center"
}, function(i) {
return "<button class='btn btn-warning btn-mini'>Add</button>";
});
});
// button click
$grid.on("click",".cell[data-col='Add'] button",function() {
var diag = $grid.grid("confirm","Are you sure you want to add?",function() {
$grid.grid("notify","fake add",1000);
console.log("diag",diag);
});
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment