📙
Aurelia-Slickgrid
Live DemoGitHub
  • Introduction
  • Getting Started
    • Quick start
  • Styling
    • Dark Mode
    • Styling CSS/SASS/Themes
  • Column Functionalities
    • Cell Menu (Action Menu)
    • Editors
      • Autocomplete
      • old Date Picker (flatpickr)
      • new Date Picker (vanilla-calendar)
      • LongText (textarea)
      • Select Dropdown Editor (single/multiple)
    • Filters
      • Autocomplete
      • Input Filter (default)
      • Select Filter (dropdown)
      • Compound Filters
      • Range Filters
      • Custom Filter
      • Styling Filled Filters
      • Single Search Filter
    • Formatters
    • Sorting
  • Events
    • Available events
    • On Events
  • Slick Grid/DataView Objects
    • Slick Grid/DataView Objects
  • Grid Functionalities
    • Auto-Resize / Resizer Service
    • Resize by Cell Content
    • Column Picker
    • Composite Editor Modal
    • Custom Tooltip
    • Add, Update or Highlight a Datagrid Item
    • Dynamically Add CSS Classes to Item Rows
    • Column & Row Spanning
    • Context Menu
    • Custom Footer
    • Excel Copy Buffer Plugin
    • Export to Excel
    • Export to File (csv/txt)
    • Grid Menu
    • Grid State & Presets
    • Grouping & Aggregators
    • Header & Footer Slots
    • Header Menu & Header Buttons
    • Infinite Scroll
    • Pinning (frozen) of Columns/Rows
    • Providing data to the grid
    • Row Detail
    • Row Selection
    • Tree Data Grid
    • Row Based Editing Plugin
  • Developer Guides
    • CSP Compliance
  • Localization
    • with I18N
    • with Custom Locales
  • Backend Services
    • Custom Backend Service
    • OData
    • GraphQL
      • JSON Result Structure
      • Filtering Schema
      • Pagination Schema
      • Sorting Schema
  • Testing
    • Testing Patterns
  • Migrations
    • Migration Guide to 2.x (2018-06-23)
    • Migration Guide to 3.x (2020-12-20)
    • Migration Guide to 4.x (2021-12-11)
    • Migration Guide to 5.x (2022-10-18)
    • Migration Guide to 6.x (2023-05-29)
    • Migration Guide to 7.x (2023-12-15)
    • Migration Guide to 8.x (2024-05-10)
    • Migration Guide to 9.x (2025-05-10)
Powered by GitBook
On this page
Edit on GitHub
  1. Column Functionalities
  2. Editors

old Date Picker (flatpickr)

Last updated 22 days ago

  • See the for more general info about Editors (validators, event handlers, ...)

Information

The Date Editor is provided through an external library named and all options from that library can be added to your editorOptions (see below), so in order to add things like minimum date, disabling dates, ... just review all the and then add them into editorOptions. Also just so you know, editorOptions is use by all other editors as well to expose external library like Flatpickr, Multiple-Select.js, etc...

Demo

|

Editor Options

You can use any of the Flatpickr by adding them to editorOptions as shown below.

Interface.

defineGrid() {
  this.columnDefinitions = [
    {
      id: 'title', name: 'Title', field: 'title',
      editor: {
        model: Editors.date,
        editorOptions: {
          minDate: 'today',
          disable: [(date: Date) => this.isWeekendDay(date)], // disable weekend days (Sat, Sunday)
        } as FlatpickrOption,
      },
    },
  ];
}

/** Returns true when it's a weekend day (Saturday, Sunday) */
isWeekendDay(date: Date): boolean {
  return (date.getDay() === 0 || date.getDay() === 6);
}

Grid Option `defaultEditorOptions

You could also define certain options as a global level (for the entire grid or even all grids) by taking advantage of the defaultEditorOptions Grid Option. Note that they are set via the editor type as a key name (autocompleter, date, ...) and then the content is the same as editorOptions (also note that each key is already typed with the correct editor option interface), for example

this.gridOptions = {
  defaultEditorOptions: {
    date: { minDate: 'today' }, // typed as FlatpickrOption
  }
}

Custom Validator

defineGrid() {
  this.columnDefinitions = [
    {
      id: 'title', name: 'Title', field: 'title',
      editor: {
        model: Editors.date,
        required: true,
        validator: (value, args) => {
          const dataContext = args && args.item;
          if (dataContext && (dataContext.completed && !value)) {
            return { valid: false, msg: 'You must provide a "Finish" date when "Completed" is checked.' };
          }
          return { valid: true, msg: '' };
        }
      },
    },
  ];
}

You can add a Custom Validator from an external function or inline (inline is shown below and comes from )

Example 3
Editors - Wiki
Flatpickr
Flatpickr Examples
Demo Page
Demo Component
options
FlatpickrOption
Editor Options
Custom Validator