diprokon / ng-table-virtual-scroll

Virtual Scroll for Angular Material Table
https://diprokon.github.io/ng-table-virtual-scroll
MIT License
134 stars 42 forks source link

Render table when lost focus #35

Closed riwos closed 4 years ago

riwos commented 4 years ago

Hi,

I created exmaple about a behaviour current issue whether even maybe a bug:

Here is example to have a look: Example

Step replication:

  1. Click 'Primary Button'

  2. Output Result (Console):

    Service Data Source: 0
    Service Data Source: 1000
  3. Click on search input and populate a word 'Wood'

  4. Output Result:

    ########### Search Start ##############
    Data Table Source:
    1000
    Filter Table Data:
    2
    [Object, Object]
    ########### Search End ##############
    Service Data Source: 2
    Screenshot 2020-07-25 at 11 09 02
  5. Remove couple of letters to make a result: 'Wo'

  6. Output Result:

    ########### Search Start ##############
    Data Table Source:
    1000
    Filter Table Data:
    7
    [Object, Object, Object, Object, Object, Object, Object]
    ########### Search End ##############
    Service Data Source: 7
    Screenshot 2020-07-25 at 11 13 33

MAGIC MOMENT: LOST FOCUS FROM THE INPUT AND THEN:

Screenshot 2020-07-25 at 11 15 20

BUT !!!

remove and clear a input and you have an old results, i expect whole list..

Screenshot 2020-07-25 at 11 16 52

QUESTION: What I'm doing wrong whether you have a bug and you don't refresh the list or call a proper event that tells the list has been updated and you have to refresh and render again

PLEASE HELPPPPPP :D @diprokon

diprokon commented 4 years ago

Hi! Looks like there is some problem with filtering (https://github.com/diprokon/ng-table-virtual-scroll/issues/34) and it affects your code. Let me check it first.

diprokon commented 4 years ago

Hi! I checked your example one more time 1) there is no need to use additional MatTableDataSource - TableVirtualScrollDataSource is replacing it 2) you need to create dataSource only once - after you can change its filter property (if you need to filter) or data property (if your list of data was changed)

You can find good example of filter usage here: https://diprokon.github.io/ng-table-virtual-scroll/#/examples -> "Table with filter, sort and selection" (there is code example provided)

riwos commented 4 years ago

Hi !

Yeah, you are right.. it was my mistake..

Like you said I don't need a 'MatTableDataSource' anymore.

However thank you for your time and investigation. I fixed a demo and I left a proper code if anyone would like to have a look it.

Thanks again @diprokon !!