Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
id: dxDataGrid.Options.aiAssistant
type: AIAssistant
inheritsType: AIAssistant
---
---
##### shortDescription
<!-- Description goes here -->
Configures the {WidgetName} AI Assistant.

---
<!-- Description goes here -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
id: dxDataGrid.Options.aiAssistant.customizeResponseText
type: function(command)
---
---
##### shortDescription
Customizes AI Assistant response texts for each requested command.

##### param(command): DataGridCommandInfo
Information about the command.

##### return: ResponseStatusTexts
Custom texts for **success** and **failure** response statuses.

---
Use this function to customize response message texts for AI Assistant commands. **customizeResponseText** is called for each requested command. The AI Assistant chat displays these texts below the response title. When a response includes multiple commands, the chat displays each command's text on separate lines.

When a command succeeds, the AI Assistant chat displays the response text in green and prefixes the text with a checkmark button emoji (✅). When a command fails, the AI Assistant chat displays the text in red and prefixes with a cross mark emoji (❌) instead.

The **command** parameter contains the following fields:

- **name**: The command's name ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)).
- **args**: Command arguments. Refer to [DataGridPredefinedCommands]({basewidgetpath}/Types/DataGridPredefinedCommands/) for information about the arguments of each available command.

Configure **customizeResponseText** to return an object with the following fields:

- **success**: Text to display when the command succeeds.
- **failure**: Text to display when the command fails.

Omit a field in the return object to use default texts.

You can use this function to translate response texts. The following code snippet uses the [locale()](/Documentation/ApiReference/Common/Utils/localization/#locale) method to specify texts for multiple locales:

---

##### jQuery

<!-- tab: index.js -->
const currentLocale = DevExpress.localization.locale();

$('#{widget-name}-container').dx{WidgetName}({
aiAssistant: {
customizeResponseText(command) {
switch (currentLocale) {
case 'en':
return {
success: `Command succeeded: ${command.name}`,
failure: `Command failed: ${command.name}`,
};
case 'fr':
return { /* Translated texts */ };
}
},
},
});

##### Angular

<!-- tab: app.component.html -->
<dx-{widget-name}>
<dxo-data-grid-ai-assistant
[enabled]="true"
[customizeResponseText]="customizeResponseText"
></dxo-data-grid-ai-assistant>
</dx-{widget-name}>

<!-- tab: app.component.ts -->
import { Dx{WidgetName}Module, type Dx{WidgetName}Types } from 'devextreme-angular/ui/{widget-name}';
import { locale } from "devextreme/localization";

export class AppComponent {
currentLocale = locale();
customizeResponseText = (command) => {
switch (this.currentLocale) {
case 'en':
return {
success: `Command succeeded: ${command.name}`,
failure: `Command failed: ${command.name}`,
};
case 'fr':
return { /* Translated texts */ };
}
};
}

##### Vue

<!-- tab: App.vue -->
<template>
<Dx{WidgetName}>
<DxAIAssistant
:customize-response-text="customizeResponseText"
/>
</Dx{WidgetName}>
</template>

<script setup lang="ts">
import { Dx{WidgetName}, DxAIAssistant, type Dx{WidgetName}Types } from 'devextreme-vue/{widget-name}';
import { locale } from "devextreme/localization";

const currentLocale = locale();
function customizeResponseText(command) {
switch (currentLocale) {
case 'en':
return {
success: `Command succeeded: ${command.name}`,
failure: `Command failed: ${command.name}`,
};
case 'fr':
return { /* Translated texts */ };
}
};
</script>

##### React

<!-- tab: App.tsx -->
import { {WidgetName}, AIAssistant, type {WidgetName}Types } from 'devextreme-react/{widget-name}';
import { locale } from "devextreme/localization";

const currentLocale = locale();
function customizeResponseText(command) {
switch (currentLocale) {
case 'en':
return {
success: `Command succeeded: ${command.name}`,
failure: `Command failed: ${command.name}`,
};
case 'fr':
return { /* Translated texts */ };
}
};

function App() {
return (
<{WidgetName}>
<AIAssistant
enabled={true}
customizeResponseText={customizeResponseText}
/>
</{WidgetName}>
);
};

---
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
id: dxDataGrid.Options.aiAssistant.customizeResponseTitle
type: function(status, commandNames)
---
---
##### shortDescription
Customizes AI Assistant response titles.

##### param(status): Enums.ResponseStatus
The response status. If a response includes multiple requested commands, all must succeed for this parameter to return *"success"*.

##### param(commandNames): Array<String>
An array of requested commands ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)).

##### return: String
The custom response title.

---
Use this function to customize the titles of AI Assistant response messages.

You can use this function to translate response texts. The following code snippet uses the [locale()](/Documentation/ApiReference/Common/Utils/localization/#locale) method to specify texts for multiple locales:

---

##### jQuery

<!-- tab: index.js -->
const currentLocale = DevExpress.localization.locale();

$('#{widget-name}-container').dx{WidgetName}({
aiAssistant: {
customizeResponseTitle(status, commandNames) {
switch (currentLocale) {
case 'en':
return `${status.toUpperCase()}: ${commandNames.join(', ')}`;
case 'fr':
return /* Translated texts */;
}
Comment thread
arman-boyakhchyan marked this conversation as resolved.
},
},
});

##### Angular

<!-- tab: app.component.html -->
<dx-{widget-name}>
<dxo-data-grid-ai-assistant
[enabled]="true"
[customizeResponseTitle]="customizeResponseTitle"
></dxo-data-grid-ai-assistant>
</dx-{widget-name}>

<!-- tab: app.component.ts -->
import { Dx{WidgetName}Module, type Dx{WidgetName}Types } from 'devextreme-angular/ui/{widget-name}';
import { locale } from "devextreme/localization";

export class AppComponent {
currentLocale = locale();
customizeResponseTitle = (status, commandNames) => {
switch (this.currentLocale) {
case 'en':
return `${status.toUpperCase()}: ${commandNames.join(', ')}`;
case 'fr':
return /* Translated texts */;
}
};
}

##### Vue

<!-- tab: App.vue -->
<template>
<Dx{WidgetName}>
<DxAIAssistant
:customize-response-title="customizeResponseTitle"
/>
</Dx{WidgetName}>
</template>

<script setup lang="ts">
import { Dx{WidgetName}, DxAIAssistant, type Dx{WidgetName}Types } from 'devextreme-vue/{widget-name}';
import { locale } from "devextreme/localization";

const currentLocale = locale();
function customizeResponseTitle(status, commandNames) {
switch (currentLocale) {
case 'en':
return `${status.toUpperCase()}: ${commandNames.join(', ')}`;
case 'fr':
return /* Translated texts */;
}
};
</script>

##### React

<!-- tab: App.tsx -->
import { {WidgetName}, AIAssistant, type {WidgetName}Types } from 'devextreme-react/{widget-name}';
import { locale } from "devextreme/localization";

const currentLocale = locale();
function customizeResponseTitle(status, commandNames) {
switch (currentLocale) {
case 'en':
return `${status.toUpperCase()}: ${commandNames.join(', ')}`;
case 'fr':
return /* Translated texts */;
}
};

function App() {
return (
<{WidgetName}>
<AIAssistant
enabled={true}
customizeResponseTitle={customizeResponseTitle}
/>
</{WidgetName}>
);
};

---
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
id: DataGridCommandInfo
module: ui/data_grid
export: DataGridCommandInfo
type: CommandInfo
generateTypeLink:
---
---
##### shortDescription
Information about a predefined DataGrid command.

---
**DataGridCommandInfo** contains the following fields:

- **name**: The predefined command's name ([DataGridPredefinedCommandNames]({basewidgetpath}/Types/DataGridPredefinedCommandNames/)).
- **args**: Command arguments. Refer to [DataGridPredefinedCommands]({basewidgetpath}/Types/DataGridPredefinedCommands/) for information about the arguments of each available command.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
id: DataGridPredefinedCommandNames
module: ui/data_grid
export: DataGridPredefinedCommandNames
type: String
---
---
##### shortDescription
Names of predefined commands available in the DevExtreme DataGrid.

---
The following commands are available:

- **columnsVisibility**
- **columnsReorder**
- **columnsPinning**
- **columnsResize**
- **filterValue**
- **clearFilter**
- **focusRowByKey**
- **focusRowByIndex**
- **paging**
- **pageSize**
- **pageIndex**
- **searching**
- **selectByKeys**
- **selectByIndexes**
- **selectAll**
- **deselectAll**
- **clearSelection**
- **sorting**
- **clearSorting**
- **grouping**
- **clearGrouping**
- **summary**
- **clearSummary**

#####See Also#####
- [DataGridPredefinedCommands]({basewidgetpath}/Types/DataGridPredefinedCommands)
Loading
Loading