Devextreme-reactive: Filter input loses focus on typing a character

Created on 13 May 2019  路  6Comments  路  Source: DevExpress/devextreme-reactive

I was searching for the issue and found a similar topic that was closed without a solution:

https://github.com/DevExpress/devextreme-reactive/issues/1977

What's missing in the linked example (https://codesandbox.io/s/1075zr955j) is a customized cell component (for hiding disabled filters for example).

If you add

<TableFilterRow 
   cellComponent={FilterCell}
/>

and

const FilterCell = (props) => {
  return <TableFilterRow.Cell {...props} />;
};

then the input field loses the focus after every change.

Would be nice to have a fix / workaround for that.

Greets!

Grid question

Most helpful comment

@MaximKudriavtsev

I somehow read over "You should avoid defining components inside render methods"... moved my custom cell component outside the render function and it worked :)

Thank you for the quick support!

All 6 comments

Hi @tazomazo,

All work fine on my side. Can you modify my example to reproduce the issue?

ScreenRecording20190513at1

Hi @MaximKudriavtsev,

you didn't add the custom cell component to TableFilterRow.

I updated your example:
https://codesandbox.io/s/9yo00kp50y

@tazomazo,

No, I added a custom cell and defined this component before defining a class. You should avoid defining components inside render methods. Please follow this聽guide聽for more information.

The updated example.

@MaximKudriavtsev

I somehow read over "You should avoid defining components inside render methods"... moved my custom cell component outside the render function and it worked :)

Thank you for the quick support!

@tazomazo,

You are welcome!

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linuxhype picture linuxhype  路  3Comments

bloolizard picture bloolizard  路  3Comments

stclairdaniel picture stclairdaniel  路  3Comments

jesusgp22 picture jesusgp22  路  3Comments

SferaDev picture SferaDev  路  3Comments