Skip to content

Filter + MobX - MeteorJS #490

@josefheld

Description

@josefheld

Hi,

I have the following situation:
My container loads data from Meteor backend via a Meteor handleTableChange. When the data arrives I set it to an observed variable. This causes the table to be updated.
My problem is, that the value in the filter box is removed and it is unknown to the user what filter is used.
To get back to the original list, the user can only reload the whole page...

The examples in the story book use setState. But that is irrelevant for my case... My issue also appears when using setState.

What I am wondering is, that as soon as I type a letter, the function handleTableChange is called. I assumed it should only be called after pressing ENTER.

Here's my function handleTableChange:

handleTableChange = (type, {page, sizePerPage, filters, sortField, sortOrder, cellEdit}) => {
        this.loading = true;  // @observable loading = true;
        if (type === 'filter' || type === 'sort' || type === 'pagination') {
            Meteor.call('contractors.loadList', type, page, sizePerPage, filters, sortField, sortOrder, cellEdit, (err, res) => {
                if (res) {
                    this.data = res.data; //  @observable data = [];
                    this.listProps = res;  // @observable listProps = { page: 1, sizePerPage: 10, totalSize: 0 };
                }
                this.loading = false;
            });
        }
    };

The server loads data from database, does the sorting, filtering and paginating of the result set.

I hope you can give me some guidance where or if I am doing something wrong.

Thank you,
Josef

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions