form.children[i].value = '';
}
+function select_update(id, options, empty)
+{
+ var obj = document.getElementById(id);
+ if (!obj) return;
+
+ if (typeof empty == 'undefined') empty = 0;
+
+ obj.options.length = empty;
+
+ for (var i=0; i < options.length; i++)
+ obj.options[empty+i] = new Option(options[i].text,options[i].id,false,false);
+}
+
+var post_save = function() { grid_update(grid); }
+var post_delete = function() { grid_update(grid); }
+
function save_callback(data)
{
info('Datensatz gespeichert');
- grid_update(grid);
+
+ if (typeof post_save == 'function')
+ post_save();
}
function delete_callback(data)
{
info('Datensatz gelöscht');
- grid_update(grid);
+
+ if (typeof post_delete == 'function')
+ post_delete();
}
function form_save(obj)
{
+ var id = document.getElementById('edit_id');
+
+ if (!id.value.length)
+ return form_insert(obj);
+
info('');
ajax_request('save', Form.serialize(obj.form), save_callback);
return false;
function form_delete(obj)
{
var id = document.getElementById('edit_id');
+
+ if (!id.value.length) return;
+
var source = document.getElementById('edit_source');
info('');
var params = 'id='+id.value + '&source='+source.value;
grid.buffer.fetch(-1);
}
+function grid_update_filters(grid)
+{
+ var todo = false;
+ for (var c=0; c < grid.headerColCnt; c++) {
+ var fmt = grid.columns[c].format;
+ if (typeof fmt.filterUI != 'string') continue;
+ if (fmt.filterUI != 's') continue;
+ $(grid.filterId(c)).options.length = 1;
+
+ var options = {};
+ Object.extend(options, grid.buffer.ajaxOptions);
+ var colnum = typeof(fmt.filterCol)=='number' ? fmt.filterCol : c;
+
+ options.parameters = 'id='+grid.tableId+'&distinct='+colnum;
+ options.onComplete = grid.filterValuesUpdate.bind(grid,c);
+ new Ajax.Request(grid.buffer.dataSource, options);
+ }
+}
+
var calendars = new Array();
function calendar_callback(value)
{