File tree Expand file tree Collapse file tree 2 files changed +33
-6
lines changed
packages/devextreme/js/__internal/grids/new/grid_core/selection Expand file tree Collapse file tree 2 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,38 @@ describe('SelectionController', () => {
200200 expect ( selectionController . getSelectedCardsData ( ) )
201201 . toEqual ( dataController . items . peek ( ) ) ;
202202 } ) ;
203+
204+ describe ( 'when the selected cards are on different pages' , ( ) => {
205+ it ( 'should return data for all selected cards' , ( ) => {
206+ const {
207+ selectionController,
208+ dataController,
209+ } = setup ( {
210+ keyExpr : 'id' ,
211+ dataSource : [
212+ { id : 1 , value : 'test1' } ,
213+ { id : 2 , value : 'test2' } ,
214+ { id : 3 , value : 'test3' } ,
215+ ] ,
216+ selectedCardKeys : [ 1 , 3 ] ,
217+ paging : {
218+ enabled : true ,
219+ pageSize : 2 ,
220+ } ,
221+ } ) ;
222+
223+ expect ( dataController . items . peek ( ) )
224+ . toEqual ( [
225+ { id : 1 , value : 'test1' } ,
226+ { id : 2 , value : 'test2' } ,
227+ ] ) ;
228+ expect ( selectionController . getSelectedCardsData ( ) )
229+ . toEqual ( [
230+ { id : 1 , value : 'test1' } ,
231+ { id : 3 , value : 'test3' } ,
232+ ] ) ;
233+ } ) ;
234+ } ) ;
203235 } ) ;
204236
205237 describe ( 'clearSelection' , ( ) => {
Original file line number Diff line number Diff line change @@ -365,12 +365,7 @@ export class SelectionController {
365365 }
366366
367367 public getSelectedCardsData ( ) : DataObject [ ] {
368- const selectedCardKey = this . getSelectedCardKeys ( ) ;
369-
370- return selectedCardKey
371- . map ( ( key ) => this . itemsController . getCardByKey ( key ) )
372- . filter ( ( item ) : item is CardInfo => ! ! item )
373- . map ( ( item ) => item . data ) ;
368+ return this . selectionHelper ?. peek ( ) ?. getSelectedItems ( ) ;
374369 }
375370
376371 public getSelectedCardKeys ( ) : Key [ ] {
You can’t perform that action at this time.
0 commit comments