Back to Devexpress

MailMergeOptions Class

aspnetcore-js-devexpress-dot-richedit-df236be2.md

latest3.3 KB
Original Source

MailMergeOptions Class

Contains properties related to the mail merge functionality.

Declaration

ts
export class MailMergeOptions

Properties

activeRecordIndex Property

Specifies the active record’s index.

Declaration

ts
get activeRecordIndex(): number
set activeRecordIndex(value: number)

Property Value

TypeDescription
number

The active record index.

|

Remarks

Use the activeRecordIndex method to navigate through records when the viewMergedData property is set to true.

javascript
richEdit.mailMergeOptions.activeRecordIndex = 15;

viewMergedData Property

Specifies whether the merged data is displayed in the Rich Text Editor.

Declaration

ts
get viewMergedData(): boolean
set viewMergedData(value: boolean)

Property Value

TypeDescription
boolean

true to display the merged data; false to hide the merged data.

|

Remarks

javascript
richEdit.mailMergeOptions.viewMergedData = true;

Methods

getDataSource Method

Returns a data source object to which the mail merge functionality is bound.

Declaration

ts
getDataSource(): any

Returns

TypeDescription
any

A data source object.

|

Remarks

javascript
richEdit.mailMergeOptions.getDataSource();

setDataSource(dataSource) Method

Specifies the data source for the mail merge.

Declaration

ts
setDataSource(
    dataSource: any,
    callback?: (success: boolean) => void
): void

Parameters

NameTypeDescription
dataSourceany

The data source object.

| | callback | (success: boolean) => void |

A function that is called after the data source is initialized.

|

Remarks

The setDataSource method can accept the DataSource object as the dataSource parameter.

javascript
var newDataSource = [
    { firstName: "Alex", birthYear: 1991 },
    { firstName: "Joe", birthYear: 1990 },
    { firstName: "Bob", birthYear: 1995 }
];
richEdit.mailMergeOptions.setDataSource(newDataSource);
javascript
var newDataSource = [
    { firstName: "Alex", birthYear: 1991 },
    { firstName: "Joe", birthYear: 1990 },
    { firstName: "Bob", birthYear: 1995 }
];
richEdit.mailMergeOptions.setDataSource(new DevExpress.data.DataSource({
    store: {
        type:'array', data: newDataSource
    },
    filter: ['birthYear', '>', 1990],
    map: function (dataItem) {
        return {
            description: dataItem.firstName + ' was born in ' + dataItem.birthYear,
            firstName: dataItem.firstName
        }
    }
}));

Send null as a parameter to remove the data source from the control and disable the mail merge functionality.

javascript
richEdit.mailMergeOptions.setDataSource(null);