-
-
Notifications
You must be signed in to change notification settings - Fork 120
LongText Editor (textarea)
ghiscoding edited this page Dec 12, 2022
·
5 revisions
- Editor Options
- Custom Validator
- See the Editors - Wiki for more general info about Editors (validators, event handlers, ...)
Demo Page | Demo Component - ("Title" column to be more specific)
You can change button texts, textarea size (cols, rows) and also change position of the textarea (auto is the default which will try to automatically find best place to position the textarea).
LongTextEditorOption Interface.
initializeGrid() {
this.columnDefinitions = [
{
id: 'title', name: 'Title', field: 'title',
editor: {
model: Editors.longText,
required: true, maxLength: 12,
editorOptions: {
cols: 45,
rows: 6,
position: 'auto', // defaults to "auto" but you can change to "top", "bottom", "left" or "right"
buttonTexts: {
// you can change the button texts
cancel: 'Close',
save: 'Done'
// or if you use translation you can use the properties with `Key` suffix
// cancelKey: 'CANCEL',
// saveKey: 'SAVE',
}
} as LongTextEditorOption,
},
},
];
}
You can add a Custom Validator, from an external function or inline.
// you can create custom validator to pass to an inline editor
const myCustomTitleValidator = (value, args) => {
if ((value === null || value === undefined || !value.length) && (args.compositeEditorOptions && args.compositeEditorOptions.modalType === 'create' || args.compositeEditorOptions.modalType === 'edit')) {
// we will only check if the field is supplied when it's an inline editing OR a composite editor of type create/edit
return { valid: false, msg: 'This is a required field.' };
} else if (!/^(task\s\d+)*$/i.test(value)) {
return { valid: false, msg: 'Your title is invalid, it must start with "Task" followed by a number.' };
}
return { valid: true, msg: '' };
};
initializeGrid() {
this.columnDefinitions = [
{
id: 'title', name: 'Title', field: 'title',
editor: {
model: Editors.longText,
required: true,
validator: myCustomTitleValidator,
},
},
];
}
Contents
- Angular-Slickgrid Wiki
- Installation
- Styling
- Interfaces/Models
- Testing Patterns
- Column Functionalities
- Global Grid Options
- Localization
- Events
- Grid Functionalities
- Auto-Resize / Resizer Service
- Resize by Cell Content
- Composite Editor
- Context Menu
- Custom Tooltip
- Add/Delete/Update or Highlight item
- Dynamically Change Row CSS Classes
- Excel Copy Buffer
- Export to Excel
- Export to File (CSV/Txt)
- Grid State & Presets
- Grouping & Aggregators
- Row Detail
- SlickGrid Controls
- SlickGrid Plugins
- Pinning (frozen) of Columns/Rows
- Tree Data Grid
- SlickGrid & DataView objects
- Addons (controls/plugins)
- Backend Services