Skip to content

Instantly share code, notes, and snippets.

@marti1125
Created February 8, 2014 03:12
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 marti1125/8876115 to your computer and use it in GitHub Desktop.
Save marti1125/8876115 to your computer and use it in GitHub Desktop.
backgrid select of hours
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