react icon indicating copy to clipboard operation
react copied to clipboard

[BUG] pagination, the query is undefined

Open giannisdag opened this issue 5 years ago • 5 comments

Environment

Please provide as many details as you can:

  • Hosting type
    • [] Form.io
    • [x] Local deployment
      • Version:
  • Formio.js version: 2.0.0-beta.3
  • Frontend framework: react
  • Browser: firefox
  • Browser version:

Steps to Reproduce

  1. Form grid shows the filtered forms based on getForms query
  2. click a specific page number
  3. the forms are filtered based on the number but not and on query

Expected behavior

It should filter the forms based on query and page

Observed behavior

Filters only on page

Example

If possible, please provide a screenshot, live example (via JSFiddle or similar), and/or example code to help demonstrate the issue.

For code or form JSON, please enclose in a code block:

	render() {
		const { forms, onAction, getForms, errors, auth, queryFromState } = this.props;

		if (forms.isActive) {
			return <Loading />;
		}
		return (
			<div>
				<Errors errors={errors} />
				{auth.is.administrator ? <h3>Administrator</h3> : null}
				{auth.is.authenticated ? <h3>Authenticated</h3> : null}
				<FormGrid
					forms={forms}
					operations={operations(auth.is.administrator)}
					onAction={onAction}
					getForms={getForms}
				/>
				{/* <Link className="btn btn-primary" to="/form/create"><i className="fa fa-plus"></i> Create Form</Link> */}
			</div>
		);
	}
};

const mapDispatchToProps = dispatch => {
	return {
		getForms: (page, query) => {
			dispatch(indexForms('forms', page, query));
		},
	};
};

giannisdag avatar Apr 09 '20 11:04 giannisdag

Can you try running the latest version of react and see if you are still seeing this issue? The latest version of react is 4.3.0.

wag110894 avatar Apr 09 '20 14:04 wag110894

I have upgraded formio-react to 4.3.0, formiojs to ^4.9.10, still the same. Query param in getForms is undefined. It looks like it needs to pass the query param. Right now I think it gets only the page from onSelect event in Pagination component

giannisdag avatar Apr 09 '20 15:04 giannisdag

Could you please provide a JSFiddle of this issue occurring?

wag110894 avatar Apr 09 '20 16:04 wag110894

It is the first time I am using jsfiddle, I do not know if this is what you are expecting, I can sent screenshots of the app if you like. https://jsfiddle.net/sgjk4ra5/

giannisdag avatar Apr 09 '20 16:04 giannisdag

An extra property could be added in FormsGrid, for example query, and then we could have an extra function like onSort, let's call it onPage =(page) => {}, onPage={this.onPage}. There we could call getForms with the query param too. Just a thought

giannisdag avatar Apr 09 '20 16:04 giannisdag

I am closing the issue as it was created too long ago and there are no new comments here. I hope it was resolved. If not, please reopen it. Thanks!

TanyaGashtold avatar Aug 31 '23 13:08 TanyaGashtold