Skip to content
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

Reinitialize gridviewscroll when table size increase #65

Open
Dgs-asohail4 opened this issue Mar 24, 2019 · 8 comments
Open

Reinitialize gridviewscroll when table size increase #65

Dgs-asohail4 opened this issue Mar 24, 2019 · 8 comments

Comments

@Dgs-asohail4
Copy link

I want to reinit the gridviewscroll on pagination or number of rows per page increases. Initially the grid has only 10 rows per page on pagination or on page size dropdown change, i make http request to fetch more rows. GridViewScroll doesn't apply on the new rows added to the table (ss attached). Is there any way to reinitialize the after table data change? or there is some other way to make this work with pagination. Am i doing something wrong?

image

@twlikol
Copy link
Owner

twlikol commented Mar 24, 2019

Are you call undo method before fetch data?

@Dgs-asohail4
Copy link
Author

ApplyGridViewScroll() {
    this.gridViewScroll.undo();
    this.gridViewScroll = new GridViewScroll(this.gridViewScrollOptions);
  }

this is what i did AFTER data change

@twlikol
Copy link
Owner

twlikol commented Mar 24, 2019

Try call undo method first, then fetch data, then apply gridviewscroll

@Dgs-asohail4
Copy link
Author

Dgs-asohail4 commented Mar 24, 2019

onPageChange(event: any) {
    this.gridViewScroll.undo();
    ... // changing row data here
    this.gridViewScroll = new GridViewScroll(this.gridViewScrollOptions);
  }

It is undoing the gridviewscroll but not being able to reapply it.

@twlikol
Copy link
Owner

twlikol commented Mar 24, 2019

onPageChange(event: any) {
    this.gridViewScroll.undo();
    ... // changing row data here
    this.gridViewScroll = new GridViewScroll(this.gridViewScrollOptions);
    this.gridViewScroll.enhance();
  }

@Dgs-asohail4
Copy link
Author

Dgs-asohail4 commented Mar 24, 2019

better ... but it's messing up the data on second application and throwing error "Cannot read property 'className' of null" on third application
image

@twlikol
Copy link
Owner

twlikol commented Mar 24, 2019

I think you can just remove the data (Table) form dom, then re-create, then apply gridviewscroll.

@Dgs-asohail4
Copy link
Author

Dgs-asohail4 commented Mar 24, 2019

an example perhaps on stackbiltz? i am using and external library for creating table (to get pagination sorting out of box) and i am using typescript version of the library on angular. I should've told you this before but little help with example would be appreciating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants