Skip to main content
Solved

Customize File Dialog Box and Add column to the grid

  • September 19, 2022
  • 2 replies
  • 306 views

arun83
Jr Varsity II
Forum|alt.badge.img

Hi team,

 

Is it possible to customize file dialog to add new column.

 

 

Thanks,

Arun.

Best answer by Nayan Mansinha

darylbowman wrote:

I asked a similar question to Developer support in the past and was told it was either not possible or not practical. I forget which.

Short answer is - not possible.  

This dialog is not available for customization, except that one can only add some custom buttons to it.  e.g. below:

     public class FilesDialogExtender : IFilesDialogExtender

    {
        public void AddAction(PXGraph graph, string view)
        {
            if ((graph is PXGenericInqGrph) ||
                 (String.IsNullOrEmpty(graph.PrimaryView)) ||
                 (graph.PrimaryItemType == null))
            { return; }

            if (!graph.Actions.Contains("MyButton"))
            {
                PXButtonDelegate uploadFromDemo1 = delegate (PXAdapter adapter)
                {
                    var g = adapter.View.Graph;
                    g.Views[g.PrimaryView].Ask("MyButton", MessageButtons.OK);
                    return adapter.Get();
                };
                PXButtonAttribute buttonAttribute = null;
                {
                    buttonAttribute = PXEventSubscriberAttribute.CreateInstance<PXButtonAttribute>();
                    buttonAttribute.VisibleOnDataSource = false;
                    buttonAttribute.PopupVisible = false;
                }

                PXUIFieldAttribute uiFieldAttribute = null;
                {
                    uiFieldAttribute = PXEventSubscriberAttribute.CreateInstance<PXUIFieldAttribute>();
                    uiFieldAttribute.DisplayName = "My Button";
                    uiFieldAttribute.Visible = true;
                    uiFieldAttribute.MapEnableRights = PXCacheRights.Select;
                    uiFieldAttribute.MapViewRights = PXCacheRights.Select;
                }
                List<PXEventSubscriberAttribute> attribs = new List<PXEventSubscriberAttribute>();
                attribs.Add(buttonAttribute);
                attribs.Add(uiFieldAttribute);
                PXNamedAction.AddAction(graph, graph.PrimaryItemType, "MyButton", "My Button", uploadFromDemo1, attribs.ToArray());
            }
        }

        public IEnumerable<ToolbarButtonDescriptor> GetToolbarButtons(PXGraph graph, string view)
        {
            Type graphType = graph?.GetType();
            if ((graphType != typeof(PXGenericInqGrph)))
            {
                var btn = new ToolbarButtonDescriptor(null, "MyButton", "MyButton");
                btn.CommandArgument = view;

                return new ToolbarButtonDescriptor[] { btn };
            }
            return null;
        }
    }

 

View original
Did this topic help you find an answer to your question?

2 replies

darylbowman
Captain II
Forum|alt.badge.img+13

I asked a similar question to Developer support in the past and was told it was either not possible or not practical. I forget which.

If it is possible, I would like to customize the column sizes.


Nayan Mansinha
Community Manager
Forum|alt.badge.img+2
  • Acumatica Developer Support
  • 49 replies
  • Answer
  • September 19, 2022
darylbowman wrote:

I asked a similar question to Developer support in the past and was told it was either not possible or not practical. I forget which.

Short answer is - not possible.  

This dialog is not available for customization, except that one can only add some custom buttons to it.  e.g. below:

     public class FilesDialogExtender : IFilesDialogExtender

    {
        public void AddAction(PXGraph graph, string view)
        {
            if ((graph is PXGenericInqGrph) ||
                 (String.IsNullOrEmpty(graph.PrimaryView)) ||
                 (graph.PrimaryItemType == null))
            { return; }

            if (!graph.Actions.Contains("MyButton"))
            {
                PXButtonDelegate uploadFromDemo1 = delegate (PXAdapter adapter)
                {
                    var g = adapter.View.Graph;
                    g.Views[g.PrimaryView].Ask("MyButton", MessageButtons.OK);
                    return adapter.Get();
                };
                PXButtonAttribute buttonAttribute = null;
                {
                    buttonAttribute = PXEventSubscriberAttribute.CreateInstance<PXButtonAttribute>();
                    buttonAttribute.VisibleOnDataSource = false;
                    buttonAttribute.PopupVisible = false;
                }

                PXUIFieldAttribute uiFieldAttribute = null;
                {
                    uiFieldAttribute = PXEventSubscriberAttribute.CreateInstance<PXUIFieldAttribute>();
                    uiFieldAttribute.DisplayName = "My Button";
                    uiFieldAttribute.Visible = true;
                    uiFieldAttribute.MapEnableRights = PXCacheRights.Select;
                    uiFieldAttribute.MapViewRights = PXCacheRights.Select;
                }
                List<PXEventSubscriberAttribute> attribs = new List<PXEventSubscriberAttribute>();
                attribs.Add(buttonAttribute);
                attribs.Add(uiFieldAttribute);
                PXNamedAction.AddAction(graph, graph.PrimaryItemType, "MyButton", "My Button", uploadFromDemo1, attribs.ToArray());
            }
        }

        public IEnumerable<ToolbarButtonDescriptor> GetToolbarButtons(PXGraph graph, string view)
        {
            Type graphType = graph?.GetType();
            if ((graphType != typeof(PXGenericInqGrph)))
            {
                var btn = new ToolbarButtonDescriptor(null, "MyButton", "MyButton");
                btn.CommandArgument = view;

                return new ToolbarButtonDescriptor[] { btn };
            }
            return null;
        }
    }

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings