Permalink
Browse files

Fixed bug in - Complex dynamic rows

  • Loading branch information...
erikuus committed Oct 4, 2011
1 parent c2cafc3 commit 343778db0e6008b05176124390fbcc65a893c13e
View
@@ -161,7 +161,7 @@ select
input.autocomplete
{
- background: #FFFFE0;
+ background: #FFFFE0;
}
input.readonly
@@ -222,29 +222,29 @@ div.errorMessage
color: #C00;
}
-label.error
+label.error
{
- display: block;
+ display: block;
}
div.add
{
- cursor: pointer;
- width: 60px;
- padding: 2px;
- border: 1px solid #a6c9e2;
- color: #0066a7;
- text-align: center;
+ cursor: pointer;
+ width: 60px;
+ padding: 2px;
+ border: 1px solid #a6c9e2;
+ color: #0066a7;
+ text-align: center;
}
div.remove
{
- cursor: pointer;
- width: 60px;
- padding: 2px;
- border: 1px solid #a6c9e2;
- color: #0066a7;
- text-align: center;
+ cursor: pointer;
+ width: 60px;
+ padding: 2px;
+ border: 1px solid #a6c9e2;
+ color: #0066a7;
+ text-align: center;
}
textarea.template

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,31 +1,31 @@
/**
* jQuery script for adding new content from template field
- *
+ *
* NOTE!
* This script depends on jquery.format.js
- *
- * IMPORTANT!
+ *
+ * IMPORTANT!
* Do not change anything except specific commands!
*/
-jQuery(document).ready(function(){
- removeEmptyHeads();
+jQuery(document).ready(function(){
+ hideEmptyHeaders();
$(".add").click(function(){
var template = jQuery.format(jQuery.trim($(this).siblings(".template").val()));
var place = $(this).parents(".templateFrame:first").children(".templateTarget");
- var i = place.children(".templateContent").size();
+ var i = place.find(".rowIndex").length>0 ? place.find(".rowIndex").max()+1 : 0;
$(template(i)).appendTo(place);
place.siblings('.templateHead').show()
// start specific commands
-
+
// end specific commands
- });
-
- $(".remove").live("click", function() {
+ });
+
+ $(".remove").live("click", function() {
$(this).parents(".templateContent:first").remove();
- removeEmptyHeads();
+ hideEmptyHeaders();
});
});
-function removeEmptyHeads(){
+function hideEmptyHeaders(){
$('.templateTarget').filter(function(){return $.trim($(this).text())===''}).siblings('.templateHead').hide();
}
Oops, something went wrong.

0 comments on commit 343778d

Please sign in to comment.