Skip to main content
Solved

Trouble adding a custom Action to an MUI grid menu in 25R2

  • January 15, 2026
  • 9 replies
  • 122 views
  • Translate All

Joe Schmucker
Captain II
Forum|alt.badge.img+3

This question was asked and answered before.  But the solution on that topic does not work in 25R2 for me.

PXAction created on Graph ext Show on Modern UI grid Header | Community

I'm trying to add a custom action to a grid on AP301000.  I am working on a local demo instance with no other customizations.

I am able to add my action, but when I do, all the other actions on the grid disappear.

I tried this

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }

@gridConfig({

    preset: GridPreset.Details, autoGrowInHeight: GridAutoGrowMode.Fill, repaintColumns: true,

    topBarItems: {

        AddNew: { index: 0, config: { commandName: "AllocateLine", text: "Allocate Line" } }

    }

})

 

And this

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }

@gridConfig({

    topBarItems: {

        AddNew: { index: 0, config: { commandName: "AllocateLine", text: "Allocate Line" } }

    }

})

Any assistance would be greatly appreciated.

Best answer by aleksandrsechin

​@Joe Schmucker 
Try this adjusted code:

import {
PXFieldState,
PXFieldOptions,
PXActionState,
placeAfterProperty,
columnConfig,
} from "client-controls";

import { APTran } from "src/screens/AP/AP301000/AP301000";

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }
export class AP301000_APTran_ICSAllocations_converted {

AllocateLine: PXActionState;

@placeAfterProperty("CuryLineAmt")
@columnConfig({
editorConfig: {
allowEdit: true,
parameters: null,
},
width: 140,
})
UsrAllocationID: PXFieldState<PXFieldOptions.CommitChanges>;

@placeAfterProperty("UsrAllocationID")
DiscPct: PXFieldState<PXFieldOptions.CommitChanges>;
}

 

View original

9 replies

Forum|alt.badge.img+11
  • Captain II
  • January 16, 2026

​@Joe Schmucker 

 

Have you tried without AddNew: { }

With just index: 0, config: { commandName: "AllocateLine", text: "Allocate Line" }

Translate

Forum|alt.badge.img+4

Hi ​@Joe Schmucker 
 Here is a simple approach to adding a custom action to the grid:

import { PXActionState } from "client-controls";

import { APTran } from "src/screens/AP/AP301000/AP301000";

export interface APTran_MyProject extends APTran { }
export class APTran_MyProject {
MyAction: PXActionState;
}

 

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

I already have a line with this in it.  


export interface AP301000_ICSAllocations_converted extends AP301000 {}

export class AP301000_ICSAllocations_converted {
AllocateLine: PXActionState;
}

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }
@gridConfig({
topBarItems: {
AddNew: { index: 0, config: { commandName: "AllocateLine", text: "Allocate Line" } }
}
})

If I don’t put my other code in, the action does not show up.

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

​@Joe Schmucker 

 

Have you tried without AddNew: { }

With just index: 0, config: { commandName: "AllocateLine", text: "Allocate Line" }

Get errors.

 

Translate

Forum|alt.badge.img+4

​@Joe Schmucker, you don’t need to define the action additionally in your @gridConfig decorator. Just define the action as shown in my code snippet and remove any other definitions of this action from your .ts file.

Translate

Forum|alt.badge.img+4

​@Joe Schmucker  and note that in your code you define the action in the class that extends the PXScreen (AP301000). This is fine for summary-level actions. For grid actions, however, you need to define them in the class that extends PXView, such as APTran. Here is probably the final code you need:

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }
export class AP301000_APTran_ICSAllocations_converted {
AllocateLine: PXActionState;
})

 

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

​@aleksandrsechin 

I tried adding your code adapting it to my project.

I am probably missing something but this is over my head.  I am sorry for being such a noob.

Here is my code for this ts file.  What am I doing wrong? 

 

import {
PXFieldState,
PXFieldOptions,
PXView,
PXActionState,
updateDecorator,
removeDecorator,
featureInstalled,
FeaturesSet,
placeBeforeView,
placeAfterView,
placeBeforeProperty,
placeAfterProperty,
graphInfo,
viewInfo,
gridConfig,
columnConfig,
treeConfig,
controlConfig,
linkCommand,
fieldOptions,
fieldConfig,
fieldInfo,
headerDescription,
autoRefresh,
mappedToViewField,
suppressLabel,
readOnly,
disabled,
unbound,
text,
multiLine,
primaryKey,
type,
ControlParameter,
NetType,
MenuItemRenderType,
ScrollMode,
TextAlign,
GridPreset,
GridColumnType,
GridColumnShowHideMode,
GridColumnDisplayMode,
GridAutoGrowMode,
GridPagerMode,
GridFastFilterVisibility,
GridNoteFilesShowMode,
HeaderDescription,
GridColumnGeneration,
GridFilterBarVisibility,
NodeSelectMode,
PXSelectorMode,
ApplySuggestionMode,
ITextEditorControlConfig,
ITimeSpanConfig,
ISelectorControlConfig,
ISegmentedSelectorControlConfig,
IEditorControlConfig,
INumberEditorControlConfig,
IMaskEditorControlConfig,
IMailEditorControlConfig,
ILinkEditorControlConfig,
IDropDownConfig,
IDatetimeEditControlConfig,
IColorPickerControlConfig,
ICheckBoxControlConfig,
ICalendarControlConfig,
IBranchSelectorConfig,
IBarcodeInputControlConfig,
ITreeSelectorConfig,
IRichTextEditorConfig,
IFormulaEditorConfig,
ICurrencyControlConfig,
FieldGenerationMode,
} from "client-controls";
import { AP301000, APTran } from "src/screens/AP/AP301000/AP301000";

export interface AP301000_ICSAllocations_converted extends AP301000 {}

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }
export class AP301000_ICSAllocations_converted {
AllocateLine: PXActionState;
}

export class AP301000_APTran_ICSAllocations_converted {
@placeAfterProperty("CuryLineAmt")
@columnConfig({
editorConfig: {
allowEdit: true,
parameters: null,
},
width: 140,
})
UsrAllocationID: PXFieldState<PXFieldOptions.CommitChanges>;

@placeAfterProperty("UsrAllocationID")
DiscPct: PXFieldState<PXFieldOptions.CommitChanges>;

}

 

Translate

Forum|alt.badge.img+4

​@Joe Schmucker 
Try this adjusted code:

import {
PXFieldState,
PXFieldOptions,
PXActionState,
placeAfterProperty,
columnConfig,
} from "client-controls";

import { APTran } from "src/screens/AP/AP301000/AP301000";

export interface AP301000_APTran_ICSAllocations_converted extends APTran { }
export class AP301000_APTran_ICSAllocations_converted {

AllocateLine: PXActionState;

@placeAfterProperty("CuryLineAmt")
@columnConfig({
editorConfig: {
allowEdit: true,
parameters: null,
},
width: 140,
})
UsrAllocationID: PXFieldState<PXFieldOptions.CommitChanges>;

@placeAfterProperty("UsrAllocationID")
DiscPct: PXFieldState<PXFieldOptions.CommitChanges>;
}

 

Translate

Joe Schmucker
Captain II
Forum|alt.badge.img+3

​@aleksandrsechin HERO.  Works great!!!!

THANK YOU!!

Translate