[form] [layout] renumber sections after refresh

This commit is contained in:
Rushabh Mehta 2013-07-09 11:28:16 +05:30
parent 189389e821
commit 6ba11facdd
2 changed files with 9 additions and 1 deletions

View file

@ -567,6 +567,8 @@ _f.Frm.prototype.refresh_dependency = function() {
}
}
}
this.layout.refresh_section_count();
}
_f.Frm.prototype.setnewdoc = function(docname) {

View file

@ -79,7 +79,7 @@ wn.ui.form.Layout = Class.extend({
this.labelled_section_count++;
$('<h3 class="col col-lg-12">'
+ (df.options ? (' <i class="text-muted '+df.options+'"></i> ') : "")
+ this.labelled_section_count + ". "
+ '<span class="section-count-label">' + this.labelled_section_count + "</span>. "
+ df.label
+ "</h3>")
.css({
@ -96,6 +96,7 @@ wn.ui.form.Layout = Class.extend({
$('<div class="col col-lg-12 small text-muted">' + df.description + '</div>').appendTo(this.section);
}
if(df.label || df.description) {
// spacer
$('<div class="col col-lg-12"></div>')
.appendTo(this.section)
.css({"height": "20px"});
@ -117,6 +118,11 @@ wn.ui.form.Layout = Class.extend({
}
return this.section;
},
refresh_section_count: function() {
this.wrapper.find(".section-count-label:visible").each(function(i) {
$(this).html(i+1);
});
},
setup_tabbing: function() {
var me = this;
this.wrapper.on("keydown", function(ev) {