Odevzdávátko: fix JS formsetu
This commit is contained in:
		
							parent
							
								
									dac2cc8b51
								
							
						
					
					
						commit
						d61f723636
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		|  | @ -26,8 +26,9 @@ function deleteForm(prefix, btn) { | ||||||
|     if (total >= 1){ |     if (total >= 1){ | ||||||
|         btn.closest('tr').remove(); |         btn.closest('tr').remove(); | ||||||
|         var forms = $('.hodnoceni'); |         var forms = $('.hodnoceni'); | ||||||
|         $('#id_' + prefix + '-TOTAL_FORMS').val(forms.length); |         var formCount = forms.length - 1; // There is one extra such form hidden as template! | ||||||
|         for (var i=0, formCount=forms.length; i<formCount; i++) { |         $('#id_' + prefix + '-TOTAL_FORMS').val(formCount); | ||||||
|  |         for (var i=0; i<formCount; i++) { | ||||||
|             $(forms.get(i)).find(':input').each(function() { |             $(forms.get(i)).find(':input').each(function() { | ||||||
|                 updateElementIndex(this, prefix, i); |                 updateElementIndex(this, prefix, i); | ||||||
|             }); |             }); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky