-
Notifications
You must be signed in to change notification settings - Fork 6
Remote filtering initial sample #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: vnext
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you really need this file?
|
|
||
| return ( | ||
| <div className="container sample ig-typography"> | ||
| <h3>Remote Filtering & Sorting Grid</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again extra file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this file?
| import { IgrColumn, IgrFilteringExpressionsTree, IgrFilteringStrategy } from "igniteui-react-grids"; | ||
|
|
||
| const DATA_URL = 'https://services.odata.org/V4/Northwind/Northwind.svc/Products'; | ||
| const EMPTY_STRING = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variables
| const filterExpr = this.buildFilterExpression(filteringArgs); | ||
| if (filterExpr) parts.push(filterExpr); | ||
|
|
||
| return `${baseQuery}&${parts.join('&')}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same problem with URL ending in '&'
| const result = await RemoteService.getData(filterExpressions, sortExpressions); | ||
| setData(result); | ||
| } catch (error) { | ||
| console.error('Error fetching data:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setData([])
… used enums for types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please resolve comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not needed
| }; | ||
|
|
||
| useEffect(() => { | ||
| fetchData(); // initial load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we make a new request when we scroll to see the remaining data in the grid instead of fetching everything at once?
|
|
||
| public static getData(skip: number = 0, take: number = 50): Promise<any[]> { | ||
| try { | ||
| if (skip < 0 || take <= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still 2 requests made on load initially
https://services.odata.org/V4/Northwind/Northwind.svc/Products?$count=true&$skip=0&$top=1
https://services.odata.org/V4/Northwind/Northwind.svc/Products?$count=true&$skip=0&$top=50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need this file?
|
|
||
| // Initialize the filtering strategy for RemoteService | ||
| useEffect(() => { | ||
| RemoteService._filteringStrategy = new IgrFilteringStrategy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This produces an error. Sample doesn't run. Please check it
No description provided.