inline grid selection bug

This issue has been tracked since 2021-11-22.

ezgif-4-ab06ba2661c4

mpf82 wrote this answer on 2021-11-22

Can you plese provide a fiddle to demonstrate the issue?

My guess is you don't set a unique recid for the added records.

ooo4321 wrote this answer on 2021-11-22

thank you, found it it was because of the format of the response, it breaks if i send :
["status"=>"success", "total"=>$model->count(), "records"=>$model->all()]
but it works ok if i send only :
["status"=>"success", "records"=>$model->all()]

mpf82 wrote this answer on 2021-11-22

If you provide total it must represent the number of records available for the grid, not the number of records your current request returns.

E.g. your database contains 12,000 records and you are pulling them with limit 1,000, then total should always be 12,000 so the grid know that there are still records to pull from the server (during scrolling), until all 12,000 are present in the grid.

If you do not set total, or if you explicitely set total to -1, then you are basically telling the grid that you don't know how many records are there to pull from the server and the grid will not perform any load requests during scrolling (unless you manually set grid.last.xhr_hasMore, which is quite low-level).

If your grid has an url and you're "manually" adding records to the grid, you must update grid.total accordingly.

Only if your grid has no url set, then grid.add() will automaticall set this.total = this.records.length.

ooo4321 wrote this answer on 2021-11-22
ooo4321 wrote this answer on 2021-11-22

This is another very strange misbehavior that i don't know what could cause it ... any idea ?

mpf82 wrote this answer on 2021-11-22

Unfortunately, this bug has been around for some time already, but so far noone provided a fix.

See: Fast scrolling using infinite Scroll returns blank div without records

Even in w2ui 2.0 you can reproduce it in the infinite scroll demo: http://localhost:8080/demos#/combo/5

mpf82 wrote this answer on 2021-11-22

I am closing this issue, because the initial issue turned out to be not a bug and the second issue is a duplicate.

ooo4321 wrote this answer on 2021-11-22

thank u, great programming gg

ooo4321 wrote this answer on 2021-11-22

as a tweak that works for me i added :

ooo4321 wrote this answer on 2021-11-22
            if (event.target == 'add') {
                // w2ui.grid1.exportdata(this.records,'xls')
                w2ui.grid1.add({ recid:  w2ui.grid1.records.length + 1 + 'new'},true);
                w2ui.grid1.scrollIntoView(1);
            }
ooo4321 wrote this answer on 2021-11-22

and it starts over without refresh

More Details About Repo
Owner Name vitmalina
Repo Name w2ui
Full Name vitmalina/w2ui
Language JavaScript
Created Date 2011-04-12
Updated Date 2022-06-22
Star Count 2000
Watcher Count 179
Fork Count 665
Issue Count 255

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date