@@ -22,7 +22,7 @@ define([
22
22
opened : false ,
23
23
level : 0 ,
24
24
visible : true ,
25
- initializeFieldsetDataByDefault : false , /* Data in some fieldsets should be initialized before open */
25
+ initializeFieldsetDataByDefault : false , /* Data in some fieldsets should be initialized before open */
26
26
disabled : false ,
27
27
listens : {
28
28
'opened' : 'onVisibilityChange'
@@ -77,9 +77,9 @@ define([
77
77
elem . initContainer ( this ) ;
78
78
79
79
elem . on ( {
80
- 'update' : this . onChildrenUpdate ,
81
- 'loading' : this . onContentLoading ,
82
- 'error' : this . onChildrenError
80
+ 'update' : this . onChildrenUpdate ,
81
+ 'loading' : this . onContentLoading ,
82
+ 'error' : this . onChildrenError
83
83
} ) ;
84
84
85
85
if ( this . disabled ) {
@@ -155,11 +155,42 @@ define([
155
155
* @param {String } message - error message.
156
156
*/
157
157
onChildrenError : function ( message ) {
158
- var hasErrors = this . elems . some ( 'error' ) ;
158
+ var hasErrors = false ;
159
+
160
+ if ( ! message ) {
161
+ hasErrors = this . _isChildrenHasErrors ( hasErrors , this ) ;
162
+ }
159
163
160
164
this . error ( hasErrors || message ) ;
161
165
} ,
162
166
167
+ /**
168
+ * Returns errors of children if exist
169
+ *
170
+ * @param {Boolean } hasErrors
171
+ * @param {* } container
172
+ * @return {Boolean }
173
+ * @private
174
+ */
175
+ _isChildrenHasErrors : function ( hasErrors , container ) {
176
+ var self = this ;
177
+
178
+ if ( hasErrors === false && container . hasOwnProperty ( 'elems' ) ) {
179
+ hasErrors = container . elems . some ( 'error' ) ;
180
+
181
+ if ( hasErrors === false && container . hasOwnProperty ( '_elems' ) ) {
182
+ container . _elems . forEach ( function ( child ) {
183
+
184
+ if ( hasErrors === false ) {
185
+ hasErrors = self . _isChildrenHasErrors ( hasErrors , child ) ;
186
+ }
187
+ } ) ;
188
+ }
189
+ }
190
+
191
+ return hasErrors ;
192
+ } ,
193
+
163
194
/**
164
195
* Callback that sets loading property to true.
165
196
*/
0 commit comments