我正在寻找一些方法来删除StoreFilterField的x-form-foucs css样式。
我已经在formPanel上放置了一个storeFilterFiled和其他文本字段,如果我想在textField中键入一些单词,则在单击textField之后,由于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
调用,并且已删除的styleName是“ 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将调用其具有绑定的面板中每个字段的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)
{
...
}
};