func (self *validateAndFormLayoutStructVisitor) BeginIndexedFields(indexedFields *model.MetaData) error { if indexedFields.Parent == nil { err := self.formLayout.BeginFormContent(self.form, self.ctx, self.formContent) if err != nil { return err } } if self.form.IsFieldExcluded(indexedFields, self.ctx) { return nil } // Add an empty indexedFields field to generate one extra input row for indexedFields if indexedFields.Kind == model.SliceKind && !self.isPost && indexedFields.Value.CanSet() { indexedFields.Value.Set(reflection.DeleteDefaultSliceElementsVal(indexedFields.Value)) indexedFields.Value.Set(reflection.AppendDefaultSliceElement(indexedFields.Value)) mongo.InitRefs(self.formModel) } return self.formLayout.BeginIndexedFields(indexedFields, self.form, self.ctx, self.formContent) }
func (self *setPostValuesStructVisitor) EndIndexedFields(indexedFields *model.MetaData) error { if indexedFields.Kind == model.SliceKind && indexedFields.Value.CanSet() && !self.form.IsFieldExcluded(indexedFields, self.ctx) { indexedFields.Value.Set(reflection.DeleteDefaultSliceElementsVal(indexedFields.Value)) } return nil }