formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.88k stars 1.06k forks source link

CustomDatagrid; It is not possible to add components #2173

Closed jerocon closed 9 months ago

jerocon commented 4 years ago

Hi,

in a project with angular-formio we want to extend the functionality of the Datagrid component. For this we are implementing a CustomDatagrid component. The code is the following:

import DataGridComponent from 'formiojs/components/datagrid/DataGrid';
import editForm from 'formiojs/components/datagrid/DataGrid.form';
import Components from 'formiojs/components/Components';

export default class CustomDatagridJS extends DataGridComponent {
  static schema(...extend) {
    return DataGridComponent.schema({
      label: 'CustomDatagridJS',
      type: 'customdatagridjs',
    }, ...extend);
  }

  constructor(...args) {
    super(...args);
    this.type = 'customdatagridjs';
  }

  get defaultSchema() {
    return CustomDatagridJS.schema();
  }

  static get builderInfo() {
    return {
      title: 'CustomDatagridJS',
      icon: 'th-list',
      group: 'basic',
      documentation: 'http://help.form.io/userguide/#datamap',
      weight: 20,
      schema: CustomDatagridJS.schema()
    };
  }
}

CustomDatagridJS.editForm = editForm;
Components.addComponent('customdatagridjs', CustomDatagridJS);

The component appears in the builder and it is possible to add it to a form. Then we try to drag a textfield to the area 'Drag and drop a form component' but it does not allow to do so. It seems that the area to drop components is locked and only allows to add it before or after CustomDatagrid.

Is there something we are doing wrong?

olgabann commented 9 months ago

We're currently addressing a backlog of GitHub issues. Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!