X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/af1e60da986a981abe314e8e53290593fc6c005f..706ad3223b5e5f4de2cbdefec72f0f2f78ba79f4:/sercom/widgets.py diff --git a/sercom/widgets.py b/sercom/widgets.py index c3ccea5..6379964 100644 --- a/sercom/widgets.py +++ b/sercom/widgets.py @@ -21,23 +21,25 @@ class CustomTextField(widgets.TextField): AlumnoMultiSelectAjax = ''' - function _on_alumno_get_result(lista, results) + function _on_alumno_get_result(lista, loading, results) { + load = MochiKit.DOM.getElement(loading); load.style.visibility = 'hidden'; if (results.error) { alert(results.msg); return; } - MochiKit.DOM.appendChildNodes(lista, OPTION(results.msg)); + MochiKit.DOM.appendChildNodes(lista, OPTION({'value':results.msg.id}, results.msg.value)); } - function _on_alumno_get_error(results) + function _on_alumno_get_error(loading, results) { alert(results) + load = MochiKit.DOM.getElement(loading); load.style.visibility = 'hidden'; } - function agregar_a_la_lista(texto, lista) + function agregar_a_la_lista(texto, lista, loading) { t = MochiKit.DOM.getElement(texto); @@ -54,11 +56,11 @@ AlumnoMultiSelectAjax = ''' alert('Debes seleccionar un curso primero'); return; } - load = MochiKit.DOM.getElement('loading'); + load = MochiKit.DOM.getElement(loading); load.style.visibility = 'visible'; url = "/grupo/get_inscripto?cursoid="+curso.options[curso.selectedIndex].value+"&padron="+t.value; var d = loadJSONDoc(url); - d.addCallbacks(partial(_on_alumno_get_result, lista), _on_alumno_get_error); + d.addCallbacks(partial(_on_alumno_get_result, lista, loading), partial(_on_alumno_get_error, loading)); t.value = ""; } @@ -83,9 +85,9 @@ class AlumnoMultiSelect(widgets.MultipleSelectField):
- + + onClick=" agregar_a_la_lista('${field_id}_nuevo', '${field_id}', '${name}_loading'); " />