Created
February 8, 2014 03:12
-
-
Save marti1125/8876115 to your computer and use it in GitHub Desktop.
backgrid select of hours
This file contains hidden or 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
var horas = ['07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21']; | |
var minutos = [':00',':05',':10',':15',':20',':25',':30',':35',':40',':45',':50',':55'] | |
var merged | |
var resultados = []; | |
for(h = 0; h < horas.length; h++){ | |
for(i = 0; i < minutos.length; i++){ | |
merged = horas[h].concat(minutos[i]); | |
resultados.push([merged,merged]); | |
} | |
} | |
resultados.push(["22:00","22:00"]); | |
var selectTime = Backgrid.SelectCell.extend({ | |
optionValues: resultados, | |
exitEditMode: function(e) | |
{ | |
var name = this.column.attributes.name; | |
var value = this.model.attributes[name]; | |
this.model.set({modified:true}); | |
var $divContenedorBackgrid = this.$el.parent().parent().parent().parent(); | |
var object = {}; | |
var id = String(this.model.id); | |
if($divContenedorBackgrid.data(id)) | |
{ | |
object = $divContenedorBackgrid.data(id); | |
} | |
object[name] = value; | |
$divContenedorBackgrid.data(id,object); | |
//this.$el.addClass("chosen-select"); | |
this.$el.removeClass("error"); | |
this.currentEditor.remove(); | |
this.stopListening(this.currentEditor); | |
delete this.currentEditor; | |
this.$el.removeClass("editor"); | |
this.render(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment