EasyUI
Home
Demo
Tutorial
Documentation
Download
Extension
Contact
Forum
EasyUI Forum
November 03, 2025, 08:21:34 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
EasyUI Forum
>
General Category
>
Bug Report
>
DataGrid:getSelections vs reload
Pages: [
1
]
« previous
next »
Print
Author
Topic: DataGrid:getSelections vs reload (Read 14378 times)
mzeddd
Full Member
Posts: 223
DataGrid:getSelections vs reload
«
on:
April 11, 2014, 02:00:21 AM »
I see the following problem:
Lets have datagrid with toolbar for example
1) I select one line and press "button1" which shows number of selected lines.
It returns "1" - OK
2) Line is still selected and I press "button2" to update URL for DataGrid and reload it. In new set of data "selected" line is available
Datagrid updated, previousely selected line stays selected - OK
3) Line is still selected and I press "button3" to update URL for DataGrid and reload it. In new set of data but "selected"
line is NOT available
I have new data, I don't see any selected lines - OK
4) I press "button1" and expect to see no selected lines
But once again it returns "1". And I could get ID for this record(s)
//V
«
Last Edit: April 11, 2014, 02:10:33 AM by mzeddd
»
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: DataGrid:getSelections vs reload
«
Reply #1 on:
April 12, 2014, 03:03:33 AM »
If you set 'idField' property, the datagrid will store the selected rows. When reloading data, the datagrid will find the rows in current page via 'idField' and set them selected. If you update a selected row with different 'id' value without calling 'updateRow' method, the selected status may lose but the selected row still exists.
To solve this issue, try to call 'updateRow' method to update a row before reloading it.
Logged
mzeddd
Full Member
Posts: 223
Re: DataGrid:getSelections vs reload
«
Reply #2 on:
April 12, 2014, 05:33:49 AM »
Here is small example where this problem is visible
1) Select row #1
2) Click "button1" -
get "number of selected rows:1"
3) Click "button2" -
no change as soon as DataGrid loads the same data
4) Click "button3" -
New data loaded. Row #2 and #3 replaced by #4 and #5. Row #1 still selected
5) Click "button1" -
get "number of selected rows:1"
6) Deselect row #1
7) Select row #4
8 ) Click "button1" -
get "number of selected rows:1"
9) Click "button2" -
selected row #4 disappeared as well as #5
10) Click "button1" -
get "number of selected rows:1". We don't have selected rows, but ...
Logged
stworthy
Administrator
Hero Member
Posts: 3581
Re: DataGrid:getSelections vs reload
«
Reply #3 on:
April 12, 2014, 08:31:56 AM »
If you do delete rows via background server and don't tell datagrid what rows have been deleted, you need to call 'deleteRow' method to delete what rows to be deleted before reloading new data. Please try the updated example 'index.html'.
Logged
mzeddd
Full Member
Posts: 223
Re: DataGrid:getSelections vs reload
«
Reply #4 on:
April 14, 2014, 01:48:36 AM »
Thanks for answer.
Mixed feelings.
On one hand we may not know what happend in DB. Like somebody removes record but I could still have it as 'selected' and operate with it without knowing that it is not valid anymore. (even if I reload datagrid)
On the other hand paging could be broken. As soon as now it remembers what was selected on previous pages.
As for me I decided to use 'clearSelections' functions where possible as soon as it is the simpliest way in my case.
//V
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> News
=> General Discussion
=> EasyUI for jQuery
=> EasyUI for Angular
=> EasyUI for Vue
=> EasyUI for React
=> Bug Report
Loading...