Created
October 31, 2012 18:17
-
-
Save optikalefx/3988817 to your computer and use it in GitHub Desktop.
Adding Columns / Buttons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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