Skip to main content
Solved

Dialog with Grid with In-Memory DAC from Action Button


Like the title says, I’ve created a dialog and added a grid inside. I have an action button which will pop-up the dialog/grid just fine as long as I use a database-based DAC. However, when trying to use an in-memory DAC no rows are displayed in grid… Snippets below:

 

In page extension class:

        public PXFilter<LabelZZZ> LotLabelsPanel;
        //this will work...public PXSetup<QLSetup> LotLabelsPanel;
 

        public PXAction<SOShipment> LotLabels;

        [PXUIField(DisplayName = "Lot Labels")]
        [PXButton]
        protected virtual void lotLabels()
        {

            var bbb = new LabelZZZ();
            bbb.Finish = true;
            bbb.Qty = 1;
            LotLabelsPanel.Insert(bbb);
 

            var ccc = new LabelZZZ();
            ccc.Finish = false;
            ccc.Qty = 9;
            LotLabelsPanel.Insert(ccc);


            if (LotLabelsPanel.AskExt(true) != WebDialogResult.OK) return;

        }

 

 

DAC class:

    [PXVirtual]
    [Serializable]
    public class LabelZZZ : IBqlTable
    {
        #region Qty        
        [PXDecimal(4)]
        [PXUnboundDefault(TypeCode.Decimal, "0.0000")]
        [PXUIField(DisplayName = "Qty")]
        public virtual Decimal? Qty { get; set; }
        public abstract class qty : IBqlField { }
        #endregion

        #region Finish
        [PXBool]
        [PXUIField(DisplayName = "Finish Parents")]
        public virtual bool? Finish { get; set; }
        public abstract class finish : PX.Data.BQL.BqlBool.Field<finish> { }
        #endregion
    }
 

Best answer by Naveen Boga

Hi, @jkelly80  When you use the Unbound DAC and try to display the dialog box, the cache is getting cleared and not showing any records.

Use a different View instead the same view, so that values will not clear from Cache. Sample example below.

 

NOTE: Also, I don’t see any KEY fields on the DAC that you provided, make sure that Unbound DAC should have Key fields.

 

 public PXFilter<LabelZZZ> LotLabelsPanel;
     //public PXSetup<QLSetup> LotLabelsPanel;

public PXFilter<LabelZZZ> DummyView;


        public PXAction<SOShipment> LotLabels;

        [PXUIField(DisplayName = "Lot Labels")]
        [PXButton]
        protected virtual void lotLabels()
        {

            var bbb = new LabelZZZ();
            bbb.Finish = true;
            bbb.Qty = 1;
            LotLabelsPanel.Insert(bbb);


            var ccc = new LabelZZZ();
            ccc.Finish = false;
            ccc.Qty = 9;
            LotLabelsPanel.Insert(ccc);


            if (DummyView.AskExt(true) != WebDialogResult.OK) return;

        }

 

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

3 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3393 replies
  • Answer
  • March 3, 2022

Hi, @jkelly80  When you use the Unbound DAC and try to display the dialog box, the cache is getting cleared and not showing any records.

Use a different View instead the same view, so that values will not clear from Cache. Sample example below.

 

NOTE: Also, I don’t see any KEY fields on the DAC that you provided, make sure that Unbound DAC should have Key fields.

 

 public PXFilter<LabelZZZ> LotLabelsPanel;
     //public PXSetup<QLSetup> LotLabelsPanel;

public PXFilter<LabelZZZ> DummyView;


        public PXAction<SOShipment> LotLabels;

        [PXUIField(DisplayName = "Lot Labels")]
        [PXButton]
        protected virtual void lotLabels()
        {

            var bbb = new LabelZZZ();
            bbb.Finish = true;
            bbb.Qty = 1;
            LotLabelsPanel.Insert(bbb);


            var ccc = new LabelZZZ();
            ccc.Finish = false;
            ccc.Qty = 9;
            LotLabelsPanel.Insert(ccc);


            if (DummyView.AskExt(true) != WebDialogResult.OK) return;

        }

 


  • Author
  • Freshman I
  • 2 replies
  • March 3, 2022

I’ve made the suggested changes, but now the dialog doesn’t even appear when the button is clicked. This makes sense as the dialog is somehow bound through the view. When I changed to some secondary view, the dialog would have no idea that it needs to popup???…

Below is the updated code:

        public PXFilter<LabelZZZ> LotLabelsPanel;
        public PXFilter<LabelZZZ> DummyView;


        public PXAction<SOShipment> LotLabels;

        [PXUIField(DisplayName = "Lot Labels")]
        [PXButton]
        protected virtual void lotLabels()
        {
            var bbb = new LabelZZZ();
            bbb.UID = "bbb";
            bbb.Finish = true;
            bbb.Qty = 1;
            LotLabelsPanel.Insert(bbb);

            var ccc = new LabelZZZ();
            ccc.UID = "ccc";
            ccc.Finish = false;
            ccc.Qty = 9;
            LotLabelsPanel.Insert(ccc);


            if (DummyView.AskExt(true) != WebDialogResult.OK) return;
        }



    [PXVirtual]
    [Serializable]
    public class LabelZZZ : IBqlTable
    {
        #region UID        
        [PXString(IsKey = true)]
        [PXUIField(DisplayName = "UID")]
        [PXUnboundDefault()]
        public virtual string UID { get; set; }
        public abstract class uID : IBqlField { }
        #endregion

        #region Qty        
        [PXDecimal(4)]
        [PXUnboundDefault(TypeCode.Decimal, "0.0000")]
        [PXUIField(DisplayName = "Qty")]
        public virtual Decimal? Qty { get; set; }
        public abstract class qty : IBqlField { }
        #endregion

        #region Finish
        [PXBool]
        [PXUIField(DisplayName = "Finish Parents")]
        public virtual bool? Finish { get; set; }
        public abstract class finish : PX.Data.BQL.BqlBool.Field<finish> { }
        #endregion
    }

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3393 replies
  • March 3, 2022

Hi @jkelly80 Have you provided this DummyView in the smartpanel code at .aspx page?


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