Solved

Dialog with Grid with In-Memory DAC from Action Button

  • 3 March 2022
  • 3 replies
  • 410 views

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
    }
 

icon

Best answer by Naveen Boga 3 March 2022, 06:04

View original

3 replies

Userlevel 7
Badge +19

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;

}

 

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
}

 

Userlevel 7
Badge +19

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

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved