Home  >  Q&A  >  body text

javascript - ant-design中的table组件怎么清空里面所有的数据(包括别的组件比如input)


如上图,这个table每一行都有1个input,现在我输入前两行input分别为11,22.
我现在遇到的问题是:当我删除了第二行(input是22),最后前面的数据都删除了,但是input还是原来的,我现在的想法是先把table里的所有数据都删除了,在赋值,那么有什么方法可以清空所有的?比如form 有个方法是resetFields,table怎么办呢

天蓬老师天蓬老师2742 days ago648

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-18 10:57:17

    Fixing the Input in the Table with value can solve this problem
    value={row.price}

    reply
    0
  • 黄舟

    黄舟2017-04-18 10:57:17

    The table you display is generated from your data.
    Then the table will disappear if the data is empty.
    Or you can set a field in the data and hide the table when showTable,当值为false.

    reply
    0
  • Cancelreply