$('.navbar-header .nav a h4').html('Images');

$.ajax({
	url: url,
	success: function(data){


		tableConfig.schema = [
			{label: 'Group', name:'group_id', required: true,enabled:false, type:'select', choices: '/api/groups?limit=true'},
			{label: 'Image', name:'filename',show:false, required: true, template: '<div style="width:150px;margin:0 auto;"><img style="max-width:150px;max-height:50px" src="/image/{{attributes.id}}"/></div>'},
			{label: 'Name', name:'name', required: true},
			// {label: 'Ext', name:'ext', required: true},
			{name: 'id', type:'hidden'}
		];

			tableConfig.events = [
				{'name': 'add', 'label': '<i class="fa fa-code"></i> Add', callback: function(model){
						$().berry({name:'newimage',actions:['cancel'],legend: 'Add Image(s)', fields:[
							{label: 'Group', name:'group_id', type: 'select', choices: '/api/groups?limit=true', required: true, default: {label:"Choose a group", value:'-'},value:resource_id,enabled: (resource_id == '') },
							{show:{"not_matches": {"name": "group_id","value": "-"}},type: 'upload', label: false, path: '/api/images?group_id='+resource_id, name: 'image_filename'}]}).on('uploaded:image_filename', $.proxy(function(){
									var temp = Berries.newimage.fields.image_filename.value;
									bt.add(temp);
									Berries.newimage.trigger('close');
						}, this) ).on('change:group_id', function(){	
								var groupid =this.fields.group_id.toJSON();
								this.fields.image_filename.update({path:'/api/images?group_id='+groupid}, true)
						});

				}}
			]

		tableConfig.click = function(model){
			new modal({legend: model.attributes.name, content:'<div style="text-align:center"><img style="max-width:100%" src="/image/'+model.attributes.id+'.'+model.attributes.ext+'"/><h3>'+window.location.protocol+'//'+window.location.host+'/image/'+model.attributes.id+'.'+model.attributes.ext+'</h3></div>'});
			
		},
			
		tableConfig.data = data;
		tableConfig.name = "images";
		bt = new berryTable(tableConfig)
	}
});
@@ -86,18 +86,16 @@
 (data)%7B%0A
-%0A%0A
 %09%09tableC
@@ -569,17 +569,16 @@
 %09%09%5D;%0A%0A%09%09
-%09
 tableCon
@@ -592,17 +592,16 @@
 nts = %5B%0A
-%09
 %09%09%09%7B'nam
@@ -681,18 +681,16 @@
 model)%7B%0A
-%09%09
 %09%09%09%09$().
@@ -769,18 +769,16 @@
 :%5B%0A%09%09%09%09%09
-%09%09
 %7Blabel: 
@@ -965,18 +965,16 @@
  '') %7D,%0A
-%09%09
 %09%09%09%09%09%7Bsh
@@ -1161,16 +1161,8 @@
 e', 
-$.proxy(
 func
@@ -1169,19 +1169,16 @@
 tion()%7B%0A
-%09%09%09
 %09%09%09%09%09%09va
@@ -1238,19 +1238,16 @@
 ;%0A%09%09%09%09%09%09
-%09%09%09
 bt.add(t
@@ -1258,19 +1258,16 @@
 ;%0A%09%09%09%09%09%09
-%09
-%09%09
 Berries.
@@ -1301,13 +1301,15 @@
 %09%09%09%09
-%09%09%7D, 
+%7D.bind(
 this
@@ -1351,63 +1351,8 @@
 )%7B%09%0A
-%09%09%09%09%09%09%09%09var groupid =this.fields.group_id.toJSON();%0A%09%09%09
 %09%09%09%09
@@ -1420,15 +1420,37 @@
 d='+
+this.fields.
 group
+_
 id
+.toJSON()
 %7D, t
@@ -1458,18 +1458,16 @@
 ue)%0A
-%09%09
 %09%09%09%09%7D);%0A
 %0A%09%09%09
@@ -1466,17 +1466,14 @@
 %7D);%0A
-%0A%09
 %09%09%09%7D%7D%0A
-%09
 %09%09%5D%0A
@@ -1828,14 +1828,39 @@
 %0A%09%09%7D
-,
 %0A%09%09%09%0A
+%09%09tableConfig.add = true;%0A
 %09%09ta

Remove update call on added image