我正在寻找一些方法来删除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”,而StoreFilterField已扩展了TriggerField。
TriggerField_ $ mimicBlur调用triggerBlur()。
调用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)
感谢任何帮助。
答案 0 :(得分:0)
我终于找到了警告。那就是我同时使用了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)
{
...
}
};