> Documentation index: https://www.gooddata.ai/docs/gooddata-ui/llms.txt lists every page of these docs as Markdown.

# defWithSorting()

- Package: [@gooddata/sdk-model](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/index.md)
- Kind: function
- Source: https://github.com/gooddata/gooddata-ui-sdk/blob/rel/11.64/libs/sdk-model/src/execution/executionDefinition/factory.ts

Changes sorting in the definition. Any sorting settings accumulated so far WILL be wiped out.

**Signature:**

```typescript
export declare function defWithSorting(definition: IExecutionDefinition, sorts: ISortItem[]): IExecutionDefinition;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| definition | [IExecutionDefinition](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iexecutiondefinition/index.md) | definition to alter with sorting |
| sorts | [ISortItem](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.isortitem/index.md)[] | items to sort by |

**Returns:**

[IExecutionDefinition](https://www.gooddata.ai/docs/gooddata-ui/latest/api-reference/sdk-model/sdk-model.iexecutiondefinition/index.md)

new execution with the updated sorts

## Remarks

This function MUST be used to implement IPreparedExecution.withSorting();
