riek icon indicating copy to clipboard operation
riek copied to clipboard

RIEInput is disabled after being edited

Open suziesirena opened this issue 8 years ago • 4 comments

I'm using React and Material UI table. I want to make the table cells editable so I put a RIEInput in a cell of the table. The problem is that after being edited, the RIEInput is disabled :

projet sans titre 1

you can see that the 'loading' state remains to 'true' after leaving focus the element.

here is my code :

      <TableRow key={index}>
          <TableRowColumn>
            <RIEInput
              value={item.title}
              change={(text) =>self.updateTitle(text, item.ID)}
              propName="text"
              validate={_.isString}
                />
          </TableRowColumn>
        </TableRow>

how can I manage this strange behavior?

suziesirena avatar Jun 16 '17 17:06 suziesirena

As a workaround, I have changed line 102 of RIEStatefulBase.js to force disabled to false:

disabled: false, //_this.state.loading,

But I would know why the loading state remains true...

suziesirena avatar Jun 16 '17 17:06 suziesirena

The doc clearly explains that it will be disabled until the parent React components renders the input again.

ibc avatar Aug 17 '17 12:08 ibc

I am also facing the same problem while using with React hooks. Any solution here?

saikat-bhattacharya avatar Sep 06 '19 07:09 saikat-bhattacharya

It looks like this project isn't active anymore, but inspired by @suziesirena's comment, I came across a workaround that does not require changing the source code. Use the editProps property to prevent disabling:

<RIEInput
  value={item.title}
  change={(text) =>self.updateTitle(text, item.ID)}
  propName="text"
  validate={_.isString}
  editProps={{ disabled: false }}
/>

arel avatar Sep 09 '19 17:09 arel