Search code examples
extjsgwtgxt

How to disable Touch support in GXT 4?


I'm making build, where I've added "edge" in "gxt.user.agent" and it enables lots of unneccessary gesture stuff. How can I disable it? gxt.device is set to "desktop"

Error on start :

java.lang.IllegalStateException: Event system already initialized at Unknown.java_lang_Throwable_Throwable__Ljava_lang_String_2V(bootstrap-0.js@8:1740) at Unknown.java_lang_Exception_Exception__Ljava_lang_String_2V(bootstrap-0.js@55:5413) at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2V(bootstrap-0.js@55:5423) at Unknown.new java_lang_IllegalStateException_IllegalStateException__Ljava_lang_String_2V(bootstrap-0.js@69:20816) at Unknown.com_google_gwt_user_client_impl_DOMImplStandard_ensureInit__V(bootstrap-0.js@87:11298) at Unknown.com_sencha_gxt_core_client_gestures_impl_PointerEventsSupportImpl_$clinit__V(bootstrap-0.js@5:15166) at Unknown.com_sencha_gxt_core_client_gestures_PointerEventsSupport_$clinit__V(bootstrap-0.js@3:14668) at Unknown.com_sencha_gxt_cell_core_client_AbstractEventCell_$addCellGestureAdapter__Lcom_sencha_gxt_cell_core_client_AbstractEventCell_2Lcom_sencha_gxt_core_client_gestures_CellGestureAdapter_2V(bootstrap-0.js@5:4934) at


Solution

  • The addCellGestureAdapter (the top of the stack in the question - it isn't clear what is calling it since the stack is so short) is being called too late. The DomImplStandard.ensureInit() method is designed to be called very early, before any element has listeners attached, so that the correct handlers can be ready for any element that is attached.

    GXT 4 sources are not publicly available, and support is pretty thin (Sencha made a blog post discussing how StackOverflow should be used instead of their own forums, but they don't actually seem to check StackOverflow), but I think there is a method that you can call earlier in your page lifecycle to get this going. Try adding this line as one of the first lines in your onModuleLoad, to ensure that it is wired up before the very first element is attached:

    PointerEventsSupport.impl.isSupported();
    

    You don't even need to use the return value, but just checking it should be enough to ensure that everything is wired up early enough. This isn't mentioned in any of their docs about getting started with touch, so I have to assume that this usually wires up correctly automatically, and that there is something unique about your application that prevents this.