aspnetcore-js-devexpress-dot-richedit-5b1e23cb.md
A collection of the Field objects.
export class FieldCollection extends Collection<Field>
Collection<T> FieldCollection
Creates a new field.
create(
position: number | Interval,
code?: string
): Field
| Name | Type | Description |
|---|---|---|
| position | number | Interval |
A position in the document or a document interval.
| | code | string |
A field code.
|
| Type | Description |
|---|---|
| Field |
The newly created field object.
|
You can use the create method to create a new field:
Specify a document position to insert a field and a field code.
Specify a document interval to be wrapped in a new field.
The newly created field has no result value until the field is updated. To update the field, use the UI or call the update or updateAllFields method.
See Also
Creates a new merge field.
createMergeField(
position: number,
name: string
): Field
| Name | Type | Description |
|---|---|---|
| position | number |
A position in the document.
| | name | string |
The name of a data source column.
|
| Type | Description |
|---|---|
| Field |
The newly created field.
|
The newly created field has no result value until the field is updated. To update the field, use the UI or call the update or updateAllFields method.
var subDocument = richEdit.selection.activeSubDocument;
var field = subDocument.fields.createMergeField(richEdit.selection.active, 'City');
field.update(function(self) {
console.log(subDocument.getText(self.resultInterval)); // returns "<<City>>"
});
Returns a list of fields that traverse the specified position or interval.
find(
position: number | IInterval
): Field[]
| Name | Type | Description |
|---|---|---|
| position | number | IInterval |
A document position or interval.
|
| Type | Description |
|---|---|
| Field[] |
A list of fields.
|
var subDocument = richEdit.selection.activeSubDocument;
var fields = subDocument.fields.find(richEdit.selection.active);
fields.forEach(function(field) {
console.log(subDocument.getText(field.interval));
});
Displays field codes in place of the fields in the document.
showAllFieldCodes(
doInAllSubDocuments?: boolean
): void
| Name | Type | Description |
|---|---|---|
| doInAllSubDocuments | boolean |
true , to display field codes in all sub-documents, false , to display field codes in the current sub-document only.
|
Displays field results in place of the fields in the document.
showAllFieldResults(
doInAllSubDocuments?: boolean
): void
| Name | Type | Description |
|---|---|---|
| doInAllSubDocuments | boolean |
true , to display field results in all sub-documents, false , to display field results in the current sub-document only.
|
Updates and displays all field results.
updateAllFields(
callback?: () => void,
options?: UpdateFieldsOptions
): boolean
| Name | Type | Description |
|---|---|---|
| callback | () => void |
A function that is called after fields are updated.
| | options | UpdateFieldsOptions |
An object that contains update options.
|
| Type | Description |
|---|---|
| boolean |
true , if the field has been updated successfully; otherwise, false.
|
var doInAllSubDocuments = true;
var updateTocFields = true;
var options = new DevExpress.RichEdit.UpdateFieldsOptions(doInAllSubDocuments, updateTocFields);
richEdit.document.fields.updateAllFields(function() {
console.log('Updated');
}, options);
See Also