Created
September 23, 2014 17:48
-
-
Save alexnaspo/9e3f2bdf4e6400c4be74 to your computer and use it in GitHub Desktop.
backgrid datetimepicker cell with bootstrap 3
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
# create a datetimepicker cell when using backgrid and the bootstrap3-datetimepicker | |
# this can be modified to work with other datepicker libraries | |
# http://eonasdan.github.io/bootstrap-datetimepicker/ | |
# http://backgridjs.com/ | |
MyDatePickerCellEditor = Backgrid.InputCellEditor.extend( | |
events: {} | |
initialize: -> | |
Backgrid.InputCellEditor::initialize.apply this, arguments | |
input = this | |
$(@el).datetimepicker({pickTime: false}).on 'dp.hide', (e) -> | |
e.preventDefault(); | |
command = new Backgrid.Command({}) | |
input.model.set input.column.get("name"), e.date.format('YYYY-MM-DD') | |
input.model.trigger "backgrid:edited", input.model, input.column, command | |
command = input = null | |
return | |
return | |
) | |
MyDatePickerCell = Backgrid.Cell.extend(editor: MyDatePickerCellEditor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thanks for sharing this, it's super helpful. Quick question, I'm using something very similar for a datetimepicker cell/cell editor, but I keep getting the error below. Did you experience the same issue? If so, may I ask how you resolved it? Thanks!