amis icon indicating copy to clipboard operation
amis copied to clipboard

values of the textfields in a combo as options of a select box

Open phxgbl opened this issue 4 years ago • 2 comments

实现场景:

请简单描述你想要实现的原始场景,例如:我想要实现xxx的功能...

I am tryng to implement Database table creator. Please find the image attached. Here i have a textbox for table name, then a combo for column details with items: textbox for column name and select for column type . column combo items can be added or deleted.

Below the column combo i have a primary key select , which should have the column names entered in above column combo as options. Since column combo items are not saved, i cannot retrieve the items from any API. table

存在的问题:

请简单描述你现在遇到的不符合预期的问题...

so for above scenario, i do not know how to populate the primary key select from above combo. Please let me know if this functionality can be done using Amis. Any idea will be appreciated

当前方案:

请粘贴你当前方案的完整 amis schema 代码...

code here...

phxgbl avatar Dec 30 '21 01:12 phxgbl

use this feature

{
  type: 'form',
  body: [
    {
      type: 'combo',
      name: 'columns',
      label: 'Columns',
      multiple: true,
      items: [
        {
          name: 'name',
          label: 'Name',
          type: 'input-text'
        },
        {
          name: 'type',
          label: 'Type',
          type: 'select',
          options: ['varchar', 'int']
        }
      ]
    },
    {
      label: 'pk',
      type: 'select',
      name: 'pk',
      valueField: 'name',
      labelField: 'name',
      source: '${columns}'
    }
  ]
}

RickCole21 avatar Jan 05 '22 07:01 RickCole21

@RickCole21 Thank you for your time. This is what I was looking for.

phxgbl avatar Jan 06 '22 03:01 phxgbl