gpt4 book ai didi

javascript - 在 GWT 中删除 StoreFilterField 的焦点样式

转载 作者:行者123 更新时间:2023-11-28 08:40:21 25 4
gpt4 key购买 nike

我正在寻找一些方法来删除 StoreFilterField 的 x-form-foucs css 样式.

我在 formPanel 上放置了一个 storeFilterFiled 和其他一些文本字段,如果我想在文本字段中输入一些单词,在我单击文本字段后光标将返回到 storeFilterField,因为 storeFilterField 将始终获得焦点。

已尝试使用 removeStyleName("x-form-focus");,但不起作用。

--

更新:

在获得 Tangent 建议后,我使用了 chrome 开发人员工具并在 StoreFilterField 的属性修改上中断。当我点击其他字段时,我得到了调用堆栈。

堆栈如下:

com_extjs_gxt_ui_client_core_El_$removeStyleName

已由 com_extjs_gxt_ui_client_widget_form_TriggerField_$triggerBlur 调用,删除的样式名称为“x-trigger-wrap-focus”,TriggerField 已由 StoreFilterField 扩展。

triggerBlur() 由 TriggerField_$mimicBlur 调用。 mimicBlur() 被调用

focusEventPreview = new BaseEventPreview() {
protected boolean onAutoHide(final PreviewEvent ce) {
if (ce.getEventTypeInt() == Event.ONMOUSEDOWN) {
mimicBlur(ce, ce.getTarget());
}
return false;
}
};

在 TriggerField 的 onRender() 中

整个堆栈如下:

com_extjs_gxt_ui_client_core_El_$removeStyleName__Lcom_extjs_gxt_ui_client_core_El_2Ljava_lang_String_2Lcom_extjs_gxt_ui_client_core_El_2 (0.js:15459)
com_extjs_gxt_ui_client_widget_Component_$removeStyleName__Lcom_extjs_gxt_ui_client_widget_Component_2Ljava_lang_String_2V (0.js:3276)
com_extjs_gxt_ui_client_widget_form_TriggerField_$triggerBlur__Lcom_extjs_gxt_ui_client_widget_form_TriggerField_2Lcom_extjs_gxt_ui_client_event_ComponentEvent_2V (0.js:8032)
com_extjs_gxt_ui_client_widget_form_TriggerField_triggerBlur__Lcom_extjs_gxt_ui_client_event_ComponentEvent_2V (0.js:8097)
com_extjs_gxt_ui_client_widget_form_TriggerField_$mimicBlur__Lcom_extjs_gxt_ui_client_widget_form_TriggerField_2Lcom_extjs_gxt_ui_client_event_PreviewEvent_2Lcom_google_gwt_user_client_Element_2V (0.js:7962)
com_extjs_gxt_ui_client_widget_form_TriggerField$1_onAutoHide__Lcom_extjs_gxt_ui_client_event_PreviewEvent_2Z (0.js:29870)
com_extjs_gxt_ui_client_util_BaseEventPreview_$onAutoHidePreview__Lcom_extjs_gxt_ui_client_util_BaseEventPreview_2Lcom_extjs_gxt_ui_client_event_PreviewEvent_2Z (0.js:14039)
com_extjs_gxt_ui_client_util_BaseEventPreview_onPreviewNativeEvent__Lcom_google_gwt_user_client_Event$NativePreviewEvent_2V (0.js:14114)
com_google_gwt_user_client_Event$NativePreviewEvent_$dispatch__Lcom_google_gwt_user_client_Event$NativePreviewEvent_2Lcom_google_gwt_user_client_Event$NativePreviewHandler_2V (0.js:42152)
com_google_gwt_user_client_Event$NativePreviewEvent_dispatch__Lcom_google_gwt_event_shared_EventHandler_2V (0.js:42216)
com_google_gwt_event_shared_GwtEvent_dispatch__Ljava_lang_Object_2V (0.js:35511)
com_google_web_bindery_event_shared_EventBus_dispatchEvent__Lcom_google_web_bindery_event_shared_Event_2Ljava_lang_Object_2V (0.js:35907)
com_google_web_bindery_event_shared_SimpleEventBus_$doFire__Lcom_google_web_bindery_event_shared_SimpleEventBus_2Lcom_google_web_bindery_event_shared_Event_2Ljava_lang_Object_2V (0.js:35959)
com_google_web_bindery_event_shared_SimpleEventBus_$fireEvent__Lcom_google_web_bindery_event_shared_SimpleEventBus_2Lcom_google_web_bindery_event_shared_Event_2V (0.js:36017)
com_google_gwt_event_shared_HandlerManager_$fireEvent__Lcom_google_gwt_event_shared_HandlerManager_2Lcom_google_gwt_event_shared_GwtEvent_2V (0.js:35860)
com_google_gwt_user_client_Event$NativePreviewEvent_fire__Lcom_google_gwt_event_shared_HandlerManager_2Lcom_google_gwt_dom_client_NativeEvent_2Z (0.js:42198)
com_google_gwt_user_client_Event_fireNativePreviewEvent__Lcom_google_gwt_dom_client_NativeEvent_2Z (0.js:42136)
com_google_gwt_user_client_DOM_previewEvent__Lcom_google_gwt_user_client_Event_2Z (0.js:41948)
(anonymous function) (0.js:42654)
com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2 (0.js:33472)
com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2 (0.js:33531)
(anonymous function) (0.js:33502)
(anonymous function) (0.js:42689)
com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2 (0.js:33472)
com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2 (0.js:33531)
(anonymous function) (0.js:33502)

感谢任何帮助。

最佳答案

我终于找到了注意事项。那就是我同时使用了 FormButtonBinding。 FormButtonBinding 将调用它绑定(bind)的面板中每个字段的 isValid()。 StoreFilterField 的 isValid 将始终执行 onFilter() 和 focus()...

只需重写 isValid() 如下代码:

    filter = new StoreFilterField<Model>()
{
@Override
public boolean isValid(boolean preventMark) {
if (disabled) {
return true;
}
boolean restore = this.preventMark;
this.preventMark = preventMark;
boolean result = validateValueWithOutOnFilter(getRawValue());
if (result) {
//activeErrorMessage = null;
}
this.preventMark = restore;
return result;
}

protected boolean validateValueWithOutOnFilter(String value) {
...
}

@Override
protected boolean doSelect(Store<Model> store, Model parent, Model record, String property, String filter)
{
...
}
};

关于javascript - 在 GWT 中删除 StoreFilterField 的焦点样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27834362/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com