1e41f4b71Sopenharmony_ci# GridObjectSortComponent 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci**GridObjectSortComponent** is a grid object organizer that you can use to edit, drag to sort, add, and delete grid objects. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci> **NOTE** 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> This component is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## Modules to Import 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci```ts 15e41f4b71Sopenharmony_ciimport { GridObjectSortComponent, GridObjectSortComponentItem, GridObjectSortComponentOptions, GridObjectSortComponentType } from '@kit.ArkUI' 16e41f4b71Sopenharmony_ci``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci## Child Components 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ciNot supported 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci## Attributes 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ciThe [universal attributes](ts-universal-attributes-size.md) are supported. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci## GridObjectSortComponent 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ciGridObjectSortComponent({options: GridObjectSortComponentOptions, dataList: Array\<GridObjectSortComponentItem>, onSave: (select: Array\<GridObjectSortComponentItem>, unselect: Array\<GridObjectSortComponentItem>) => void, onCancel: () => void }) 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci**Decorator**: @Component 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci**Parameters** 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci| Name | Type | Decorator| Mandatory| Description | 40e41f4b71Sopenharmony_ci| -------- | -------------------------------- | ---------- | ---- | ------------ | 41e41f4b71Sopenharmony_ci| options | [GridObjectSortComponentOptions](#gridobjectsortcomponentoptions) | @Prop | Yes | Component configuration.| 42e41f4b71Sopenharmony_ci| dataList | Array<[GridObjectSortComponentItem](#gridobjectsortcomponentitem)> | - | Yes | Data to pass. The maximum data length is 50 characters. If it is exceeded, only the first 50 characters are used.| 43e41f4b71Sopenharmony_ci| onSave | (select: Array<[GridObjectSortComponentItem](#gridobjectsortcomponentitem)>, unselect: Array<[GridObjectSortComponentItem](#gridobjectsortcomponentitem)>) => void | - | Yes| Callback invoked when changes are saved. The data after the changes is returned.| 44e41f4b71Sopenharmony_ci| onCancel | () => void | - | Yes| Callback invoked when changes are canceled.| 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci## GridObjectSortComponentOptions 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 51e41f4b71Sopenharmony_ci| -------------- | ------------------------- | ---- | ------------------------------------------------------ | 52e41f4b71Sopenharmony_ci| type | [GridObjectSortComponentType](#gridobjectsortcomponenttype) | No | Component display form: text only or\|text and imagery.<br>Default value: **GridObjectSortComponentType.text**| 53e41f4b71Sopenharmony_ci| imageSize | number \| [Resource](ts-types.md#resource) | No | Image size.<br>Default value: **56** | 54e41f4b71Sopenharmony_ci| normalTitle | [ResourceStr](ts-types.md#resourcestr) | No | Title displayed in the non-editing state.<br>Default value: **Channel** | 55e41f4b71Sopenharmony_ci| showAreaTitle | [ResourceStr](ts-types.md#resourcestr) | No | First subtitle of the display area.<br>Default value: **Drag to sort**| 56e41f4b71Sopenharmony_ci| addAreaTitle | [ResourceStr](ts-types.md#resourcestr) | No | Second subtitle of the display area.<br>Default value: **Touch to add** | 57e41f4b71Sopenharmony_ci| editTitle | [ResourceStr](ts-types.md#resourcestr) | No | Title displayed in the editing state.<br>Default value: **Edit** | 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci## GridObjectSortComponentType 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci| Name | Value | Description | 64e41f4b71Sopenharmony_ci| -------- | ----- | -------------- | 65e41f4b71Sopenharmony_ci| IMAGE_TEXT | 'image_text' | Text and imagery.| 66e41f4b71Sopenharmony_ci| TEXT | 'text' | Text only. | 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci## GridObjectSortComponentItem 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 73e41f4b71Sopenharmony_ci| -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | 74e41f4b71Sopenharmony_ci| id | string \| number | Yes | Data ID, which must be unique. | 75e41f4b71Sopenharmony_ci| text | [ResourceStr](ts-types.md#resourcestr) | Yes | Text information. | 76e41f4b71Sopenharmony_ci| selected | boolean | Yes | Whether the grid object has been added. The value **true** means that grid object has been added, and **false** means the opposite. | 77e41f4b71Sopenharmony_ci| url | [ResourceStr](ts-types.md#resourcestr) | No | URL of the image. This parameter is required when **GridObjectSortComponentType** is set to **IMAGE_TEXT**.| 78e41f4b71Sopenharmony_ci| order | number | Yes | Sequence number. | 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci## Events 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported. 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci## Example 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci```ts 87e41f4b71Sopenharmony_ciimport { GridObjectSortComponent, GridObjectSortComponentItem, GridObjectSortComponentOptions, GridObjectSortComponentType } from '@kit.ArkUI' 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci@Entry 90e41f4b71Sopenharmony_ci@Component 91e41f4b71Sopenharmony_cistruct Index { 92e41f4b71Sopenharmony_ci @State dataList: GridObjectSortComponentItem[] = [ 93e41f4b71Sopenharmony_ci { 94e41f4b71Sopenharmony_ci id: 0, 95e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_location_filled'), 96e41f4b71Sopenharmony_ci text: 'Location', 97e41f4b71Sopenharmony_ci selected: true, 98e41f4b71Sopenharmony_ci order: 3 99e41f4b71Sopenharmony_ci }, 100e41f4b71Sopenharmony_ci { 101e41f4b71Sopenharmony_ci id: 1, 102e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_mobiledata_filled'), 103e41f4b71Sopenharmony_ci text: 'Mobile data', 104e41f4b71Sopenharmony_ci selected: true, 105e41f4b71Sopenharmony_ci order: 9 106e41f4b71Sopenharmony_ci }, 107e41f4b71Sopenharmony_ci { 108e41f4b71Sopenharmony_ci id: 2, 109e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_nfc_filled'), 110e41f4b71Sopenharmony_ci text: 'NFC', 111e41f4b71Sopenharmony_ci selected: false, 112e41f4b71Sopenharmony_ci order: 1 113e41f4b71Sopenharmony_ci }, 114e41f4b71Sopenharmony_ci { 115e41f4b71Sopenharmony_ci id: 3, 116e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_ring_off_filled'), 117e41f4b71Sopenharmony_ci text: 'Silent', 118e41f4b71Sopenharmony_ci selected: true, 119e41f4b71Sopenharmony_ci order: 4 120e41f4b71Sopenharmony_ci }, 121e41f4b71Sopenharmony_ci { 122e41f4b71Sopenharmony_ci id: 4, 123e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_ring_on_filled'), 124e41f4b71Sopenharmony_ci text: 'Ring', 125e41f4b71Sopenharmony_ci selected: false, 126e41f4b71Sopenharmony_ci order: 5 127e41f4b71Sopenharmony_ci }, 128e41f4b71Sopenharmony_ci { 129e41f4b71Sopenharmony_ci id: 5, 130e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_ultra_power_saver_filled'), 131e41f4b71Sopenharmony_ci text: 'Low power', 132e41f4b71Sopenharmony_ci selected: true, 133e41f4b71Sopenharmony_ci order: 6 134e41f4b71Sopenharmony_ci }, 135e41f4b71Sopenharmony_ci { 136e41f4b71Sopenharmony_ci id: 6, 137e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_screenshot_filled'), 138e41f4b71Sopenharmony_ci text: 'Screenshot', 139e41f4b71Sopenharmony_ci selected: true, 140e41f4b71Sopenharmony_ci order: 7 141e41f4b71Sopenharmony_ci }, 142e41f4b71Sopenharmony_ci { 143e41f4b71Sopenharmony_ci id: 7, 144e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_screen_recording_filled'), 145e41f4b71Sopenharmony_ci text: 'Screen recording', 146e41f4b71Sopenharmony_ci selected: true, 147e41f4b71Sopenharmony_ci order: 8 148e41f4b71Sopenharmony_ci }, 149e41f4b71Sopenharmony_ci { 150e41f4b71Sopenharmony_ci id: 8, 151e41f4b71Sopenharmony_ci url: $r('app.media.ic_controlcenter_super_power_saver_filled'), 152e41f4b71Sopenharmony_ci text: 'Ultra power saving', 153e41f4b71Sopenharmony_ci selected: false, 154e41f4b71Sopenharmony_ci order: 9 155e41f4b71Sopenharmony_ci }, 156e41f4b71Sopenharmony_ci ] 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci @State option: GridObjectSortComponentOptions = { 159e41f4b71Sopenharmony_ci type: GridObjectSortComponentType.IMAGE_TEXT, 160e41f4b71Sopenharmony_ci imageSize: 45, 161e41f4b71Sopenharmony_ci normalTitle: 'Menu', 162e41f4b71Sopenharmony_ci editTitle: 'Edit', 163e41f4b71Sopenharmony_ci showAreaTitle: 'Drag to sort', 164e41f4b71Sopenharmony_ci addAreaTitle: 'Touch to add' 165e41f4b71Sopenharmony_ci } 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci build() { 168e41f4b71Sopenharmony_ci Column() { 169e41f4b71Sopenharmony_ci GridObjectSortComponent({ 170e41f4b71Sopenharmony_ci options: this.option, 171e41f4b71Sopenharmony_ci dataList: this.dataList, 172e41f4b71Sopenharmony_ci onSave: ( 173e41f4b71Sopenharmony_ci select: Array<GridObjectSortComponentItem>, 174e41f4b71Sopenharmony_ci unselect: Array<GridObjectSortComponentItem> 175e41f4b71Sopenharmony_ci ) => { 176e41f4b71Sopenharmony_ci // save ToDo 177e41f4b71Sopenharmony_ci }, 178e41f4b71Sopenharmony_ci onCancel: () =>{ 179e41f4b71Sopenharmony_ci // cancel ToDo 180e41f4b71Sopenharmony_ci } 181e41f4b71Sopenharmony_ci }) 182e41f4b71Sopenharmony_ci } 183e41f4b71Sopenharmony_ci } 184e41f4b71Sopenharmony_ci} 185e41f4b71Sopenharmony_ci``` 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci 188