var initValues = this.element.data('values');
- if (initValues.length === 0 && this.element.hasClass('showEmpty')) {
- this.initItem();
+ if (initValues.length === 0) {
+ if (this.element.hasClass('showEmpty')) {
+ this.initItem();
+ }
} else {
$.each(initValues, function (k, v) {
$this.initItem(v, true);
var val = [];
var $this = this;
var id = this.element.attr('id');
- var selector = '.item' + this.bmidselector + ':not(.sample) ' + this.bmidselector + ' .bunchfields';
+ var selector = '.item' + this.bmidselector + ':not(.sample) ' + this.bmidselector + '>.bunchfields';
var list = this.element.find(selector);
$.each(list, function () {
removeItem: function (item) {
$(item).remove();
- if(this.element.hasClass('showEmpty') && this.element.find('.item' + this.bmidselector + ':not(.sample)').length === 0) {
- this.initItem();
+ if (this.element.hasClass('showEmpty') && this.element.find('.item' + this.bmidselector + ':not(.sample)').length === 0) {
+ console.log('init item after remove');
+ this.initItem();
}
var $this = this;
},
initItem: function (values) {
+ console.log(values);
var $this = this;
var collapsed = true;
var isNew = false;