- {(activateCellEdit && activateCellEdit[Number(item['_grid_row_id_'])!] && activateCellEdit[Number(item['_grid_row_id_'])!]['isActivated'])
- ?
-
- ShowRowEditMode(item, Number(item['_grid_row_id_'])!, false)} iconProps={{ iconName: 'Save' }} title={'Save'}>
- {props.enableRowEditCancel
- ?
- CancelRowEditMode(item, Number(item['_grid_row_id_'])!)} iconProps={{ iconName: 'RemoveFilter' }} title={'Cancel'}>
- :
- null
- }
-
- :
-
- { !props.enableDefaultEditMode &&
- ShowRowEditMode(item, Number(item['_grid_row_id_'])!, true)} iconProps={{ iconName: 'Edit' }} title={'Edit'}>
- }{
- props.gridCopyOptions && props.gridCopyOptions.enableRowCopy &&
- HandleRowCopy(Number(item['_grid_row_id_'])!)}
- iconProps={{ iconName: "Copy" }}
- title={"Copy"}
- >
- }
-
+ {(activateCellEdit && activateCellEdit[Number(item['_grid_row_id_'])!] && activateCellEdit[Number(item['_grid_row_id_'])!]['isActivated'])
+ ?
+
+ ShowRowEditMode(item, Number(item['_grid_row_id_'])!, false)} iconProps={{ iconName: 'Save' }} title={'Save'}>
+ {props.enableRowEditCancel
+ ?
+ CancelRowEditMode(item, Number(item['_grid_row_id_'])!)} iconProps={{ iconName: 'RemoveFilter' }} title={'Cancel'}>
+ :
+ null
+ }
+
+ :
+
+ {!props.enableDefaultEditMode &&
+ ShowRowEditMode(item, Number(item['_grid_row_id_'])!, true)} iconProps={{ iconName: 'Edit' }} title={'Edit'}>
+ }{
+ props.gridCopyOptions && props.gridCopyOptions.enableRowCopy &&
+ HandleRowCopy(Number(item['_grid_row_id_'])!)}
+ iconProps={{ iconName: "Copy" }}
+ title={"Copy"}
+ >
+ }
+
}
),
});
}
-
+
return columnConfigs;
};
- const CreateCommandBarItemProps = () : ICommandBarItemProps[] => {
+ const CreateCommandBarItemProps = (): ICommandBarItemProps[] => {
let commandBarItems: ICommandBarItemProps[] = [];
-
-
- if(props.enableExport){
- commandBarItems.push({
+
+
+ if (props.enableExport) {
+ commandBarItems.push({
id: 'export',
- key: 'exportGrid',
- text: 'Export',
+ key: 'exportGrid',
+ text: 'Export',
ariaLabel: 'Export',
disabled: isGridInEdit || editMode,
- cacheKey: 'myCacheKey',
+ cacheKey: 'myCacheKey',
iconProps: { iconName: 'Download' },
subMenuProps: {
items: [
{
- key: 'exportToExcel',
- text: 'Excel Export',
- iconProps: { iconName: 'ExcelDocument' },
- onClick: () => onExportClick(ExportType.XLSX)
+ key: 'exportToExcel',
+ text: 'Excel Export',
+ iconProps: { iconName: 'ExcelDocument' },
+ onClick: () => onExportClick(ExportType.XLSX)
},
{
- key: 'exportToCSV',
- text: 'CSV Export',
- iconProps: { iconName: 'LandscapeOrientation' },
- onClick: () => onExportClick(ExportType.CSV)
+ key: 'exportToCSV',
+ text: 'CSV Export',
+ iconProps: { iconName: 'LandscapeOrientation' },
+ onClick: () => onExportClick(ExportType.CSV)
}
],
- }
+ }
});
}
- if(props.enableColumnFilterRules){
- commandBarItems.push({
- id:'columnfilter',
- key: 'columnFilters',
- text: 'Filter',
+ if (props.enableColumnFilterRules) {
+ commandBarItems.push({
+ id: 'columnfilter',
+ key: 'columnFilters',
+ text: 'Filter',
ariaLabel: 'Filter',
disabled: isGridInEdit || editMode,
- cacheKey: 'myColumnFilterCacheKey',
+ cacheKey: 'myColumnFilterCacheKey',
iconProps: { iconName: 'Filter' },
subMenuProps: {
items: [
{
- key: 'columnFilter',
- text: 'Column Filter',
- iconProps: { iconName: 'Filter' },
- onClick: () => RowSelectOperations(EditType.ColumnFilter, {})
+ key: 'columnFilter',
+ text: 'Column Filter',
+ iconProps: { iconName: 'Filter' },
+ onClick: () => RowSelectOperations(EditType.ColumnFilter, {})
},
{
- key: 'clearFilters',
- text: 'Clear Filters',
- iconProps: { iconName: 'ClearFilter' },
- onClick: () => ClearFilters()
+ key: 'clearFilters',
+ text: 'Clear Filters',
+ iconProps: { iconName: 'ClearFilter' },
+ onClick: () => ClearFilters()
}
],
- }
+ }
});
}
- if(!props.enableDefaultEditMode && props.enableTextFieldEditMode){
+ if (!props.enableDefaultEditMode && props.enableTextFieldEditMode) {
commandBarItems.push({
- id:'editmode',
+ id: 'editmode',
key: 'editmode',
disabled: isGridInEdit && !editMode,
text: !editMode ? "Edit Mode" : "Save Edits",
@@ -1455,20 +1563,20 @@ const EditableGrid = (props: Props) => {
});
}
- if(!props.enableDefaultEditMode && props.enableTextFieldEditModeCancel && editMode){
+ if (!props.enableDefaultEditMode && props.enableTextFieldEditModeCancel && editMode) {
commandBarItems.push({
key: 'editmodecancel',
disabled: isGridInEdit && !editMode,
text: "Cancel",
iconProps: { iconName: "Cancel" },
//onClick: () => {SetGridItems(defaultGridData); setEditMode(false)}
- onClick: () => {CancelGridEditMode()}
+ onClick: () => { CancelGridEditMode() }
});
}
-
- if(props.enableSave == true){
+
+ if (props.enableSave == true) {
commandBarItems.push({
- id:'submit',
+ id: 'submit',
key: 'submit',
text: 'Submit',
ariaLabel: 'Submit',
@@ -1478,18 +1586,18 @@ const EditableGrid = (props: Props) => {
});
}
- if(props.enableBulkEdit){
+ if (props.enableBulkEdit) {
commandBarItems.push({
id: 'bulkedit',
key: 'bulkedit',
text: "Bulk Edit",
disabled: isGridInEdit || editMode || selectionCount == 0,
- iconProps: { iconName: "TripleColumnEdit"},
+ iconProps: { iconName: "TripleColumnEdit" },
onClick: () => RowSelectOperations(EditType.BulkEdit, {})
});
}
- if(props.gridCopyOptions && props.gridCopyOptions.enableGridCopy){
+ if (props.gridCopyOptions && props.gridCopyOptions.enableGridCopy) {
commandBarItems.push({
key: "copy",
text: "Copy",
@@ -1498,8 +1606,8 @@ const EditableGrid = (props: Props) => {
onClick: () => CopyGridRows(),
});
}
-
- if(props.enableGridRowsAdd){
+
+ if (props.enableGridRowsAdd) {
commandBarItems.push({
id: 'addrows',
key: 'addrows',
@@ -1510,7 +1618,7 @@ const EditableGrid = (props: Props) => {
});
}
- if(props.enableRowAddWithValues && props.enableRowAddWithValues.enable){
+ if (props.enableRowAddWithValues && props.enableRowAddWithValues.enable) {
commandBarItems.push({
id: 'addrowswithdata',
key: 'addrowswithdata',
@@ -1520,8 +1628,8 @@ const EditableGrid = (props: Props) => {
onClick: () => RowSelectOperations(EditType.AddRowWithData, {})
});
}
-
- if(props.enableGridRowsDelete){
+
+ if (props.enableGridRowsDelete) {
commandBarItems.push({
id: 'deleterows',
key: 'deleterows',
@@ -1531,8 +1639,8 @@ const EditableGrid = (props: Props) => {
onClick: () => RowSelectOperations(EditType.DeleteRow, {})
});
}
-
- if(props.enableColumnEdit){
+
+ if (props.enableColumnEdit) {
commandBarItems.push({
id: 'updatecolumn',
key: 'updatecolumn',
@@ -1543,7 +1651,7 @@ const EditableGrid = (props: Props) => {
});
}
- if(props.enableGridReset){
+ if (props.enableGridReset) {
commandBarItems.push({
id: 'resetgrid',
key: 'resetGrid',
@@ -1554,30 +1662,29 @@ const EditableGrid = (props: Props) => {
});
}
- if(props.customCommandBarItems && props.customCommandBarItems.length > 0){
+ if (props.customCommandBarItems && props.customCommandBarItems.length > 0) {
return [...commandBarItems, ...props.customCommandBarItems];
}
-
+
return commandBarItems;
};
- const CreateCommandBarFarItemProps = () : ICommandBarItemProps[] => {
-
+ const CreateCommandBarFarItemProps = (): ICommandBarItemProps[] => {
+
let commandBarItems: ICommandBarItemProps[] = [];
- if(props.enableUnsavedEditIndicator && (props.enableRowEdit || props.enableCellEdit || props.enableBulkEdit || props.enableColumnEdit
- || props.enableTextFieldEditMode))
- {
- commandBarItems.push({
- id: 'info',
- key: 'info',
- text: isGridStateEdited ? 'Grid has unsaved data. Click on \'Submit\' to save' : '',
- // This needs an ariaLabel since it's icon-only
- ariaLabel: 'Info',
- disabled: !isGridStateEdited,
- iconOnly: true,
- iconProps: { iconName: 'InfoSolid' },
- });
- }
+ if (props.enableUnsavedEditIndicator && (props.enableRowEdit || props.enableCellEdit || props.enableBulkEdit || props.enableColumnEdit
+ || props.enableTextFieldEditMode)) {
+ commandBarItems.push({
+ id: 'info',
+ key: 'info',
+ text: isGridStateEdited ? 'Grid has unsaved data. Click on \'Submit\' to save' : '',
+ // This needs an ariaLabel since it's icon-only
+ ariaLabel: 'Info',
+ disabled: !isGridStateEdited,
+ iconOnly: true,
+ iconProps: { iconName: 'InfoSolid' },
+ });
+ }
commandBarItems.push({
key: "filteredrecs",
@@ -1587,7 +1694,7 @@ const EditableGrid = (props: Props) => {
x._is_filtered_in_ == true &&
x._is_filtered_in_grid_search_ == true &&
x._is_filtered_in_column_filter_ == true
- ).length}/${defaultGridData.length}`,
+ ).length}/${defaultGridData.length}`,
// This needs an ariaLabel since it's icon-only
ariaLabel: "Filtered Records",
iconOnly: false,
@@ -1597,8 +1704,8 @@ const EditableGrid = (props: Props) => {
return commandBarItems;
};
- const CreateCommandBarOverflowItemsProps = () : ICommandBarItemProps[] => {
- if(props.customCommandBarOverflowItems && props.customCommandBarOverflowItems.length > 0){
+ const CreateCommandBarOverflowItemsProps = (): ICommandBarItemProps[] => {
+ if (props.customCommandBarOverflowItems && props.customCommandBarOverflowItems.length > 0) {
return [...props.customCommandBarOverflowItems];
};
@@ -1607,49 +1714,49 @@ const EditableGrid = (props: Props) => {
const GridColumns = CreateColumnConfigs();
const CommandBarItemProps = CreateCommandBarItemProps();
- const CommandBarFarItemProps = CreateCommandBarFarItemProps();
+ const CommandBarFarItemProps = CreateCommandBarFarItemProps();
const CommandBarOverflowItemsProps = CreateCommandBarOverflowItemsProps();
- function _getSelectionDetails() : string {
+ function _getSelectionDetails(): string {
const count = _selection.getSelectedCount();
setSelectionCount(count);
setSelectedItems(_selection.getSelection())
setSelectedIndices(_selection.getSelectedIndices());
- if(props.onGridSelectionChange){
+ if (props.onGridSelectionChange) {
props.onGridSelectionChange(_selection.getSelection());
}
-
+
switch (count) {
- case 0:
- return 'No items selected';
- case 1:
- return '1 item selected: ';
- default:
- return `${count} items selected`;
+ case 0:
+ return 'No items selected';
+ case 1:
+ return '1 item selected: ';
+ default:
+ return `${count} items selected`;
}
}
const onRenderDetailsHeader: IRenderFunction