angular-schema-form icon indicating copy to clipboard operation
angular-schema-form copied to clipboard

Custom grid -- angular-ui-grid with angular-schema-form -- not working

Open anupamarachuri opened this issue 9 years ago • 7 comments

Data Grid is on of the very common scenarios for any Web Page. I am trying to create a grid using angular-schema-form. This is how my schema looks and the form. Its not working. Can you please suggest where could i be wrong?

{ "schema": { "type": "object", "title": "Grid Schema", "properties": { "grid1": { "type": "array", "description": "An Grid.", "items": [ "gridOptions", { "type": "object" } ] } } }, "form": [ { "key": "grid1", "type": "simple-grid" } ], "model": { "grid1": [ { "name": "Exert", "age": 55 }, { "name": "Tiancum", "age": 43 }, { "name": "Jacob", "age": 27 }, { "name": "Nephi", "age": 29 }, { "name": "Enos", "age": 34 } ] } }

anupamarachuri avatar Aug 02 '16 18:08 anupamarachuri

"type": "simple-grid"

This isn't currently supported in ASF's bootstrap decorator, you'd need to implement that as an addon.

slyadams avatar Aug 02 '16 20:08 slyadams

Hi Simon,

Thanks for you reply.

I forgot to mention. I have created a custom template and registered in the bootstrap-decorator.

Under src a new file with name simple-grid.html:

ng-class="{'has-error': hasError(), 'has-success': hasSuccess(), 'has-feedback': form.feedback !== false, 'float': form.float === true }"> <label class="control-label" ng-show="showTitle()"> {{form.title}} </label> <div name="{{form.key.slice(-1)[0]}}" ng-model="modelArray" sf-field-model="sf-new-array" sf-new-array class="gridStyle" ng-grid="{{form.grid1}}"></div> <div class="help-block" sf-message="form.description"></div> <div class="help-block" ng-show="(hasError() && errorMessage(schemaError()))" ng-bind-html="(hasError() && errorMessage(schemaError()))"></div>

and in the Bootstrap decorator the below code:

$templateCache.put("src/simple-grid.html", "<div class="form-group schema-form-simple-grid" ng-class="{'has-error': hasError(), 'has-success': hasSuccess(), 'has-feedback': form.feedback !== false, 'float': form.float === true }"> <label class="control-label" ng-show="showTitle()">{{form.title}} <div name="{{form.key.slice(-1)[0]}}" class="gridStyle" ng-grid="{{modelData.grid1}}"> <div class="help-block" sf-message="form.description"> <div class="help-block" ng-show="(hasError() && errorMessage(schemaError()))" ng-bind-html="(hasError() && errorMessage(schemaError()))">");

I am not sure what else I need to do to make it working.

anupamarachuri avatar Aug 03 '16 15:08 anupamarachuri

Hi All,

Can you please help with this? I also tried the below JSON Schema and did not work:

{ "schema": { "type": "object", "title": "Grid Test", "properties": { "Offerings": { "type": "array", "title": "Offerings Info", "items": { "type": "object", "properties": { "name": { "title": "Name", "type": "string" }, "email": { "title": "Email", "type": "string", "pattern": "^\S+@\S+$", "description": "Email will be used for evil." } } } } } }, "form": [ { "key": "Offerings", "type": "array", "items": [ "Offerings[].name", "Offerings[].email" ] } ] }

anupamarachuri avatar Aug 08 '16 17:08 anupamarachuri

Have you tried using bootstrap grid css styles, I think they are supported aren't they? Then just put that inside an array.

Anthropic avatar Sep 10 '16 17:09 Anthropic

I tried a month ago but did not work.. Did it work for you?

anupamarachuri avatar Sep 12 '16 19:09 anupamarachuri

@anupamarachuri I made an add-on for work that makes a basic data table, but unfortunately not of a high enough level of quality that I would release it into the wild

Anthropic avatar Sep 21 '16 07:09 Anthropic

@Anthropic I'm trying to implement a very basic data table in a module I made. Could you share your code?

sinqinc avatar Feb 22 '17 03:02 sinqinc