Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ComboboxItem - bug or unexpected behaviour using arrow keys

    I am using smartgwt 3.0, gwt 2.4 and Firefox 3.x and 8.x
    I am using the free version of smartGWT.

    I have found that when I enter in information in my combobox that if I try to use the down arrow key to get to an entry
    that the selection jumps past the first entries to further down the list instead of starting at the beginning.
    If this is designed on purpose this way then is there a way I could force it to start with the first entry?

    To test using the code below enter in 'ja' first and select 'janice'. Then append ',ji' as in the following

    janice,ji

    Then use the arrow key to traverse the list. It will jump to the next entry it left off at (fifth one down).
    This isn't the behaviour I want (or expect). I would think since I'm starting with a new popup list that the arrow keys
    should start me at the beginning.

    Here is my code.

    public class MyCode implements EntryPoint {

    public void onModuleLoad() {

    VLayout layout = new VLayout();
    DynamicForm f = new DynamicForm();
    final MyComboBox cb = new MyComboBox();


    MyDataSource myDataSource = new MyDataSource() {


    // We are displaying ALL selected values so far with a comma between them
    @Override
    protected void transformResponse(DSResponse response, DSRequest request, Object data) {
    // get entered value up to the last comma
    // this allows us to return the list of comma delimited fields
    // entered by the user so far, then append the newly selected
    // value to this list of comma delimited values
    String enteredVal = cb.getEnteredValue();
    if (enteredVal != null) {
    int index = enteredVal.lastIndexOf(",");
    if (index > 0) {
    enteredVal = enteredVal.substring(0, index + 1);
    } else {
    enteredVal = "";
    }
    }

    int index2 = enteredVal.indexOf("ji");

    // create dummy data for testing purposes
    String[] entries = {"jackie", "jake", "jane", "janice", "janny", "jash", "jashua" ,"jason", jasper", "java"};
    String[] entries2 = {"jill", "jinny", "jise", "jisea", "jiseah", "jish", "jishe", "jisper", "jispers", "jisperss"};
    // return the second list for testing purposes
    if (index2 >= 0) {
    entries = entries2;
    }
    ListGridRecord[] dummydata = new ListGridRecord[10];
    for (int i=0; i<10; i++) {
    ListGridRecord r = new ListGridRecord();
    r.setAttribute("name", enteredVal + entries[i]);
    dummydata[i] = r;
    }
    response.setData(dummydata);
    response.setTotalRows(dummydata.length);


    }
    }

    cb.setOptionDataSource(myDataSource);
    form.setFields(combobox);
    cb.setWidth(300);
    layout.addMember(f);
    layout.draw();

    }

    }

    #2
    BTW, I just noticed you can see this 'bug' if you try it out on the multi combbox in the showcase.

    First enter in 'pe' and use arrow keys to select Pencil Cup Softline #23701.

    Then enter in 'ca' and use the arrow keys to navigate the popup and you will see it jumps down in the list instead of starting with the first row.

    Comment


      #3
      Thanks for pointing this out - this has been fixed for tomorrow's builds.

      Comment

      Working...
      X