File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
src/BootstrapBlazor/Components/Table Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -42,22 +42,20 @@ protected CheckboxState HeaderCheckState()
4242 var filterRows = ShowRowCheckboxCallback == null ? Rows : Rows . Where ( ShowRowCheckboxCallback ) ;
4343 if ( filterRows . Any ( ) )
4444 {
45- if ( filterRows . All ( AnyRow ) )
45+ if ( ! filterRows . Except ( SelectedRows ) . Any ( ) )
4646 {
4747 // 所有行被选中
4848 // all rows are selected
4949 ret = CheckboxState . Checked ;
5050 }
51- else if ( filterRows . Any ( AnyRow ) )
51+ else if ( filterRows . Any ( row => SelectedRows . Any ( i => Equals ( i , row ) ) ) )
5252 {
5353 // 任意一行被选中
5454 // any one row is selected
5555 ret = CheckboxState . Indeterminate ;
5656 }
5757 }
5858 return ret ;
59-
60- bool AnyRow ( TItem row ) => SelectedRows . Any ( i => Equals ( i , row ) ) ;
6159 }
6260
6361 /// <summary>
@@ -104,7 +102,7 @@ protected CheckboxState HeaderCheckState()
104102 /// <param name="val"></param>
105103 protected virtual async Task OnHeaderCheck ( CheckboxState state , TItem val )
106104 {
107- SelectedRows . RemoveAll ( x => Rows . Any ( a => Equals ( a , x ) ) ) ;
105+ SelectedRows . RemoveAll ( Rows . Intersect ( SelectedRows ) . Contains ) ;
108106 if ( state == CheckboxState . Checked )
109107 {
110108 SelectedRows . AddRange ( ShowRowCheckboxCallback == null ? Rows : Rows . Where ( ShowRowCheckboxCallback ) ) ;
You can’t perform that action at this time.
0 commit comments