Hybrid View

  1. #1
    Ext GWT Premium Member
    Join Date
    Mar 2009
    Posts
    226
    Vote Rating
    3
    The_Jackal is on a distinguished road

      1  

    Default [GXT 2.2.5] ComboBox has no access to cancel query (dqTask) and can't stop tab select

    [GXT 2.2.5] ComboBox has no access to cancel query (dqTask) and can't stop tab select


    ComboBox has no way for another class or a subclass to cancel the query (dqTask). Please provide a public or protected cancel method that will call dqTask.cancel() as this is a common requirement if the combo subclass needs to cancel query and collapse the combo (e.g. when a certain character / operator is encountered).

    The closest method is triggerBlur() as it cancels and collpases, but it also blurs the component which is not always desired.

    In my case the suggestions that the combo is returning are part of a formula and I want to cancel the query when an operator is detected, so the next operand will start a new query.

    My current workaround is to use JSNI to access the private field.

    *Update: An alternative would be stop tab being used to pick a suggestion as this
    both picks an item and tabs to the next field (rarely what you want to do!).

    Please allow the KeyNav to be set (rather than creating it anonymously in initComponent() ). Or allow the onTab() method of the KeyNav to have a flag to choose if tab is allow to pick options (allowTab).

    Anonymous creation of the KeyNav prevents any subclass from "unbinding" this KeyNav to provide their own and it not very extension friendly. To workaround it I have to override onViewClick to ignore tab keyCodes.

    Regards,
    The_Jackal

  2. #2
    Sencha Premium Member
    Join Date
    Jun 2012
    Location
    Germany
    Posts
    28
    Vote Rating
    -1
    wwab can only hope to improve

      0  

    Default


    +1 for public cancel query method

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,732
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      1  

    Default


    Two other alternatives (I'm working on a bug in 3.x that hits the queryTask, so as long as I've made the giant cache miss of re-reading all of this code, thought I'd offer some ideas):

    * Override doQuery(String, boolean) to check your own current state and logic to decide if you continue - other wise return early without calling super.doQuery.
    * Or, if you don't want to subclass ComboBox, listen for the Events.BeforeQuery event (of type FieldEvent), and, again, based on your current state and logic, cancel the query action.

    These end up having the same effect as canceling the task, and don't require any JSNI workaround.

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2012
    Location
    Germany
    Posts
    28
    Vote Rating
    -1
    wwab can only hope to improve

      0  

    Default


    The second options seems to be a good solution(better design than first)

    Until now i solved the problem by subclassing ComboBox and implementing a method:

    public void triggerBlur() {
    triggerBlur(new ComponentEvent(this));
    }

    this also cancels the query. but your approach is better

Thread Participants: 2