angular-schema-form-bootstrap
angular-schema-form-bootstrap copied to clipboard
[Proposal] Hideable array elements
Hi, I'm using lots of arrays, and many of them have lots of elements, so I end up with long forms.
I've been searching ways to collapse elements, or at least hide them. Until now, I've reached a simple solution (which deserves some work around), but I think thats in some way functional.
src/array.html
...
<li class="list-group-item {{form.fieldHtmlClass}}"
sf-field-model="ng-repeat"
ng-repeat="item in $$value$$ track by $index">
<button ng-hide="form.readonly || form.remove === null"
ng-click="deleteFromArray($index)"
ng-disabled="form.schema.minItems >= modelArray.length"
style="position: relative; z-index: 20;"
type="button" class="close pull-right">
<span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<button
ng-click="($parent.show==$index)?$parent.show=-1:$parent.show=$index"
style="position: relative; z-index: 20; margin-right:10px"
type="button" class="close pull-right">
<span aria-hidden="true">{{($parent.show==$index)?'-':'+'}}</span><span class="sr-only">Show</span>
</button>
<div schema-form-array-items ng-class="$parent.show=={{$index}}?'':'hidden' "></div>
<span ng-class="$parent.show=={{$index}}?'hidden':''">{{$index}} - {{form.title}}</span>
</li>
...
Result
In order to test, this is the right fork and branch :) https://github.com/GerardSoleCa/angular-schema-form-bootstrap/tree/feature-array-collapse-elements
Awesome, I really need this !! Will this feature be available ?
Thank you
+1 for this, we make heavy use of child forms for which we currently use fieldset, this seems like a really nice compact alternative.