Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
formatter: Formatters.multiple,
params: { formatters: [Formatters.complexObject, Formatters.checkmark] },
// when the "field" string includes the dot "." notation, the library will consider this to be a complex object and Filter accordingly
filterable: true,
filter: {
// We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized
// enableRenderHtml: true,
// collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
collection: [{ isEffort: '', label: '' }, { isEffort: true, label: 'True' }, { isEffort: false, label: 'False' }],
customStructure: {
value: 'isEffort',
label: 'label'
},
model: Filters.singleSelect,
// we could add certain option(s) to the "multiple-select" plugin
filterOptions: {
maxHeight: 250
},
}
}
];
this.gridOptions = {
autoResize: {
containerId: 'demo-container',
sidePadding: 15
},
enableFiltering: true,
filterable: true,
sortable: true,
formatter: Formatters.dateIso,
exportWithFormatter: true,
type: FieldType.date,
filter: { model: Filters.compoundDate },
},
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
formatter: Formatters.checkmark,
type: FieldType.boolean,
sortable: true,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'true' }, { value: false, label: 'false' }],
model: Filters.singleSelect,
}
}
];
this.gridOptions1 = {
enableAutoResize: false,
enableCellNavigation: true,
enableCheckboxSelector: true,
checkboxSelector: {
// remove the unnecessary "Select All" checkbox in header when in single selection mode
hideSelectAllCheckbox: true
},
rowSelectionOptions: {
// True (Single Selection), False (Multiple Selections)
selectActiveRow: true,
},
{
id: 'complete', name: '% Complete', field: 'percentComplete', minWidth: 70, type: FieldType.number, sortable: true, width: 100,
formatter: Formatters.percentCompleteBar, filterable: true, filter: { model: Filters.slider, operator: '>' }
},
{
id: 'start', name: 'Start', field: 'start', headerKey: 'START', formatter: Formatters.dateIso, sortable: true, minWidth: 75, exportWithFormatter: true, width: 100,
type: FieldType.date, filterable: true, filter: { model: Filters.compoundDate }
},
{
id: 'completed', field: 'completed', headerKey: 'COMPLETED', minWidth: 85, maxWidth: 85, formatter: Formatters.checkmark, width: 100,
type: FieldType.boolean,
sortable: true,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
model: Filters.singleSelect
}
}
];
this.gridOptions = {
autoResize: {
containerId: 'demo-container',
sidePadding: 15
},
enableCheckboxSelector: true,
enableFiltering: true,
enableTranslate: true,
i18n: this.i18n
};
// reload the Grid State with the grid options presets
id: 'duration', name: 'Duration (days)', field: 'duration', headerKey: 'DURATION', sortable: true,
formatter: Formatters.percentCompleteBar, minWidth: 100,
filterable: true,
filter: { model: Filters.slider, /* operator: '>=',*/ params: { hideSliderNumber: true } }
},
{ id: 'start', name: 'Start', field: 'start', headerKey: 'START', formatter: Formatters.dateIso, outputType: FieldType.dateIso, type: FieldType.date, minWidth: 100, filterable: true, filter: { model: Filters.compoundDate } },
{ id: 'finish', name: 'Finish', field: 'finish', headerKey: 'FINISH', formatter: Formatters.dateIso, outputType: FieldType.dateIso, type: FieldType.date, minWidth: 100, filterable: true, filter: { model: Filters.compoundDate } },
{
id: 'completedBool', name: 'Completed', field: 'completedBool', headerKey: 'COMPLETED', minWidth: 100,
sortable: true,
formatter: Formatters.checkmark,
exportCustomFormatter: Formatters.translateBoolean,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, labelKey: 'TRUE' }, { value: false, labelKey: 'FALSE' }],
model: Filters.singleSelect,
enableTranslateLabel: true
}
},
{
id: 'completed', name: 'Completed', field: 'completed', headerKey: 'COMPLETED', formatter: Formatters.translate, sortable: true,
minWidth: 100,
exportWithFormatter: true, // you can set this property in the column definition OR in the grid options, column def has priority over grid options
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: 'TRUE', labelKey: 'TRUE' }, { value: 'FALSE', labelKey: 'FALSE' }],
collectionSortBy: {
property: 'labelKey', // will sort by translated value since "enableTranslateLabel" is true
sortDesc: true
},
model: Filters.singleSelect,
enableTranslateLabel: true
model: Filters.singleSelect,
enableTranslateLabel: true
}
},
{
id: 'completed', name: 'Completed', field: 'completed', headerKey: 'COMPLETED', formatter: Formatters.translate, sortable: true,
minWidth: 100,
exportWithFormatter: true, // you can set this property in the column definition OR in the grid options, column def has priority over grid options
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: 'TRUE', labelKey: 'TRUE' }, { value: 'FALSE', labelKey: 'FALSE' }],
collectionSortBy: {
property: 'labelKey', // will sort by translated value since "enableTranslateLabel" is true
sortDesc: true
},
model: Filters.singleSelect,
enableTranslateLabel: true
}
}
// OR via your own custom translate formatter
// { id: 'completed', name: 'Completed', field: 'completed', headerKey: 'COMPLETED', formatter: translateFormatter, sortable: true, minWidth: 100 }
];
this.gridOptions = {
autoResize: {
containerId: 'demo-container',
sidePadding: 15
},
enableAutoResize: true,
enableExcelCopyBuffer: true,
enableFiltering: true,
enableTranslate: true,
id: '%', name: '% Complete', field: 'percentComplete', sortable: true, filterable: true,
type: FieldType.number,
formatter: Formatters.percentCompleteBar,
filter: { model: Filters.compoundSlider, params: { hideSliderNumber: false } }
},
{ id: 'start', name: 'Start', field: 'start', headerKey: 'START', filterable: true, type: FieldType.dateUs, filter: { model: Filters.compoundDate } },
{ id: 'finish', name: 'Finish', field: 'finish', headerKey: 'FINISH', filterable: true, type: FieldType.dateUs, filter: { model: Filters.compoundDate } },
{
id: 'completed', name: 'Completed', field: 'completed', headerKey: 'COMPLETED', maxWidth: 80, formatter: Formatters.checkmark,
type: FieldType.boolean,
minWidth: 100,
sortable: true,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'true' }, { value: false, label: 'false' }],
model: Filters.singleSelect
}
}
];
this.gridOptions = {
columnPicker: {
hideForceFitButton: true,
hideSyncResizeButton: true,
onColumnsChanged: (e, args) => {
console.log('Column selection changed from Column Picker, visible columns: ', args.columns);
}
},
enableAutoResize: true,
enableGridMenu: true,
autoResize: {
containerId: 'demo-container',
id: '%', name: '% Complete', field: 'percentComplete', sortable: true, filterable: true,
type: FieldType.number,
formatter: Formatters.percentCompleteBar,
filter: { model: Filters.compoundSlider, params: { hideSliderNumber: false } }
},
{ id: 'start', name: 'Start', field: 'start', headerKey: 'START', filterable: true, type: FieldType.dateUs, filter: { model: Filters.compoundDate } },
{ id: 'finish', name: 'Finish', field: 'finish', headerKey: 'FINISH', filterable: true, type: FieldType.dateUs, filter: { model: Filters.compoundDate } },
{
id: 'completed', name: 'Completed', field: 'completed', headerKey: 'COMPLETED', maxWidth: 80, formatter: Formatters.checkmark,
type: FieldType.boolean,
minWidth: 100,
sortable: true,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'true' }, { value: false, label: 'false' }],
model: Filters.singleSelect,
}
}
];
this.gridOptions = {
columnPicker: {
hideForceFitButton: true,
hideSyncResizeButton: true,
onColumnsChanged: (e, args) => {
console.log('Column selection changed from Column Picker, visible columns: ', args.columns);
}
},
enableAutoResize: true,
enableGridMenu: true,
autoResize: {
containerId: 'demo-container',
customStructure: { label: 'name', value: 'code' },
collectionAsync: this.httpFetch.fetch(URL_COUNTRIES_COLLECTION),
},
filter: {
model: Filters.autoComplete,
customStructure: { label: 'name', value: 'code' },
collectionAsync: this.httpFetch.fetch(URL_COUNTRIES_COLLECTION),
}
}, {
id: 'effort-driven',
name: 'Effort Driven',
field: 'effortDriven',
filterable: true,
type: FieldType.boolean,
filter: {
model: Filters.singleSelect,
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }]
},
formatter: Formatters.checkmark,
editor: {
model: Editors.checkbox,
},
minWidth: 70
}, {
id: 'prerequisites',
name: 'Prerequisites',
field: 'prerequisites',
filterable: true,
formatter: taskFormatter,
minWidth: 100,
sortable: true,
type: FieldType.string,
sortable: true
},
{
id: 'finish', name: 'Finish', field: 'finish',
minWidth: 100, width: 120,
filterable: true,
sortable: true
},
{
id: 'effortDriven', name: 'Effort Driven', field: 'effortDriven',
minWidth: 100, width: 120,
formatter: Formatters.checkmark,
filterable: true,
filter: {
collection: [{ value: '', label: '' }, { value: true, label: 'True' }, { value: false, label: 'False' }],
model: Filters.singleSelect
},
sortable: true
},
{
id: 'title1', name: 'Title1', field: 'title1',
minWidth: 100, width: 120,
filterable: true,
sortable: true
},
{
id: 'title2', name: 'Title2', field: 'title2',
minWidth: 100, width: 120,
filterable: true,
sortable: true
},
{
defineGrid() {
this.columnDefinitions = [
{ id: 'name', field: 'name', headerKey: 'NAME', filterable: true, sortable: true, type: FieldType.string, width: 60 },
{
id: 'gender', field: 'gender', headerKey: 'GENDER', filterable: true, sortable: true, width: 60,
filter: {
model: Filters.singleSelect,
collection: [{ value: '', label: '' }, { value: 'male', label: 'male', labelKey: 'MALE' }, { value: 'female', label: 'female', labelKey: 'FEMALE' }]
}
},
{
id: 'company', field: 'company', headerKey: 'COMPANY', width: 60,
sortable: true,
filterable: true,
filter: {
model: Filters.multipleSelect,
collection: [{ value: 'acme', label: 'Acme' }, { value: 'abc', label: 'Company ABC' }, { value: 'xyz', label: 'Company XYZ' }]
}
},
{ id: 'billing.address.street', field: 'billing.address.street', headerKey: 'BILLING.ADDRESS.STREET', width: 60, filterable: true, sortable: true },
{
id: 'billing.address.zip', field: 'billing.address.zip', headerKey: 'BILLING.ADDRESS.ZIP', width: 60,
type: FieldType.number,