I’m trying to convert a popup dialog box that worked in Classic UI to Modern UI.
I’m so close, but I’m missing something. When the dialog pops up the ok button is constantly disabling. I think it has something to do with the way I’m making the view, but I can’t quite figure it out. Additional details in the view section below.
I feel like I must be close, but can’t seem to make it happen. Calling on the experts!
The Class for the dialog:
[Serializable]
[PXHidden]
public class TCAPCreateSalesOrderFilter : PXBqlTable, IBqlTable
{
public static bool IsActive()
{
return true;
}
#region OrderType
public abstract class orderType : PX.Data.BQL.BqlString.Field<orderType> { }
[PXDBString(2, IsFixed = true, InputMask = ">aa")]
[PXDefault(typeof(Search2<SOOrderType.orderType,
InnerJoin<SOSetup, On<SOOrderType.orderType, Equal<SOSetup.defaultOrderType>>>,
Where<SOOrderType.active, Equal<boolTrue>>>))]
[PXSelector(typeof(Search<SOOrderType.orderType>),
DescriptionField = typeof(SOOrderType.descr))]
[PXUIField(DisplayName = "Order Type")]
public String OrderType { get; set; }
#endregion
}
Create the view for the Dialog
This is the view. I added the second part to try and match Yuriy Zaletskyy’s blog post on the subject. This seems to be a significant part, but I don’t know what I’m doing wrong. When I have it, I get a popup with “Object reference not set to an instance of an object” but it all works. I get the dialog, it returns the result. All good. When I don’t have it there, no error, but my “Okay” is always disabled.
public PXFilter<TCAPCreateSalesOrderFilter> TCAPSOTypeDialog;
public IEnumerable tCAPSOTypeDialog(PXAdapter adapter)
{
return adapter.Get();
}
Typescript:
export interface PM301000_AcuProPopup extends PM301000{}
export class PM301000_AcuProPopup
{
CheckCopyParams: PXActionState;
@viewInfo({ containerName: "Copy To" })
TCAPSOTypeDialog = createSingle(TCAPCreateSalesOrderFilter);
}
export class TCAPCreateSalesOrderFilter extends PXView {
OrderType: PXFieldState<PXFieldOptions.CommitChanges>;
}
HTML:
<template>
<qp-panel id="TCAPSOTypeDialog" caption="Caption" auto-repaint="true">
<qp-template id="FormView" name="1-1-1" class="equal-height">
<qp-fieldset id="FormFilterSlotA" view.bind="TCAPSOTypeDialog" slot="A" caption="Pick SO Type">
<field name="OrderType"></field>
</qp-fieldset>
<footer>
<qp-button id="btnPanelOK" caption="OK" state.bind="Save" dialog-result="OK"></qp-button>
<qp-button id="btnPanelCancel" caption="Cancel" dialog-result="Cancel"></qp-button></footer>
</qp-template>
</qp-panel>
</template>