EasyUI Forum

General Category => EasyUI for React => Topic started by: Shatki on February 04, 2020, 02:36:53 PM



Title: Possibility to get a DataGrid filter rows
Post by: Shatki on February 04, 2020, 02:36:53 PM
Hello!
Is there a way to get all showed rows after applied a DataGrid filtering?
Like a sampled this:
https://www.jeasyui.com/demo-react/main/index.php?plugin=DataGrid&theme=metro-blue&dir=ltr&pitem=&sort=asc

Thanks!


Title: Re: Possibility to get a DataGrid filter rows
Post by: chrwei on February 05, 2020, 09:31:01 AM
closest I've found is to use the onFilterChange event


Title: Re: Possibility to get a DataGrid filter rows
Post by: Shatki on February 05, 2020, 10:41:01 PM
closest I've found is to use the onFilterChange event
I tried it but to no avail

I did it like this:
Code:

constructor(props){
    super(props){
    ...
    }
    this.viewRows = [],
    this.viewRowsLength = 0
}

renderCode = ({ value, row, rowIndex }) =>{
        if (rowIndex < this.viewRowsLength) this.viewRows = this.viewRows.slice(0, rowIndex + 1);
        this.viewRows[rowIndex] = row;
        this.viewRowsLength = rowIndex;
        return value
    };

<DataGrid>
    ...
    <GridColumn
        render = { this.renderCode }
        field="code" title="Code" width="10%"/>
    ...
    ...
<DataGrid/>

But maybe possible to make it more simple?


Title: Re: Possibility to get a DataGrid filter rows
Post by: chrwei on February 06, 2020, 07:30:43 AM
what did you try?  I don't see any onFilterChange there.


Title: Re: Possibility to get a DataGrid filter rows
Post by: Shatki on February 06, 2020, 09:41:22 AM
what did you try?  I don't see any onFilterChange there.
Earlier I had shown only checked worked code

Event onFilterChange give us a filterRules what we changed. I don't understand how it will help us
Thanks


Title: Re: Possibility to get a DataGrid filter rows
Post by: chrwei on February 10, 2020, 08:48:36 AM
apply the filters yourself?

it would be great if that change event also gave a reference to the filtered list object, but it's not that hard to run it yourself