簡體   English   中英

無法將焦點轉移到“裝運”屏幕上的“裝運Nbr”字段

[英]Not able to shift focus to Shipment Nbr field on Shipments screen

我正在使用內置的Acumatica瀏覽器命令通過按功能鍵來插入新的發貨記錄。 函數Key通過px.searchFrame(window.top,"main")['px_alls'].ds.executeCommand("Insert");觸發命令px.searchFrame(window.top,"main")['px_alls'].ds.executeCommand("Insert"); 由於某種原因,它會觸發插入命令,但不會將焦點轉移到Shipment Nbr輸入字段。 另外,如果您嘗試使用var field=px_alls["edShipmentNbr"]; field.focus();手動移動焦點var field=px_alls["edShipmentNbr"]; field.focus(); var field=px_alls["edShipmentNbr"]; field.focus(); 那也不起作用。 我已經能夠將焦點轉移到其他字段,所以我知道代碼是正確的,但是我無法弄清楚為什么不能將焦點轉移到Shipment Nbr輸入。 關於還有什么可以做的任何想法? 這也不只是插入命令。 調用應該轉移焦點的“取消”命令也不起作用。

奇怪的是,可以通過按Ctrl + Insert來調用Insert命令,它可以完美地工作。

我構建了一些代碼,將焦點轉移到發貨日期字段,然后向后切換了5次,從而正確模擬了insert命令應該執行的操作,但它只能在客戶端計算機上間歇地工作。

謝謝

Acumatica框架通過PXButtonAttribute中定義的以下屬性為鍵盤快捷鍵提供內置支持:

  • ShortcutShift = true / false :確定Shift鍵的存在
  • ShortcutCtrl = true / false :確定控制鍵的存在
  • ShortcutChar = 'x' :確定快捷方式字符

下面是用戶按下F2時插入新貨件的示例。 由於下面的代碼段利用了框架的功能,因此通過按F2鍵 ,用戶可以從SOShipmentEntry BLC執行插入命令,而不是模擬JavaScript中的按鈕單擊。 這種方法可確保正確執行嵌入到“ 插入”命令中的所有邏輯,包括將焦點設置為“ 貨件Nbr”輸入。

public class SOShipmentEntryExt : PXGraphExtension<SOShipmentEntry>
{
    public class PXInsertShortCut<TNode> : PXInsert<TNode> 
        where TNode : class, IBqlTable, new()
    {
        public PXInsertShortCut(PXGraph graph, string name)
        : base(graph, name)
        {
        }
        public PXInsertShortCut(PXGraph graph, Delegate handler)
            : base(graph, handler)
        {
        }
        [PXUIField(DisplayName = ActionsMessages.Insert, MapEnableRights = PXCacheRights.Insert, MapViewRights = PXCacheRights.Insert)]
        [PXInsertButton(ShortcutChar = (char)113)]
        protected override IEnumerable Handler(PXAdapter adapter)
        {
            return base.Handler(adapter);
        }
    }

    public PXInsertShortCut<SOShipment> Insert;
}

如果您正在使用JavaScript執行服務器的回調,則該回調返回在完成執行后可能會將焦點設置到另一個字段。 您的focus()語句有效,但回調返回在您之后的另一個控件上執行另一個focus()。

掛鈎Ajax回調允許您將focus()語句放在Acumatica框架focus()之后:

window.addEventListener('load', function () { px_callback.addHandler(ActionCallback); });

function ActionCallback(callbackContext) {
   px_alls["edShipmentNbr"].focus();
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM