Results 1 to 6 of 6

Thread: Select not updating selection

    Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66

    Default Select not updating selection

    I have a number of Select fields where I catch the change event and perform some processing. When I change the selected item and then go back to the Select field, the first item in the list appears to be selected even though I have changed the selection. For example:

    Create a select bound to a store that has Item A, Item B, and Item C.
    In a Controller Action catch the change event and just set me.Currentitem to newValue.data.
    Startup form and click on Item C:
    Result:
    Item C shows in the text area of the Select but the next time you click on the Select Field or Trigger Item A will be highlighted and checked. If you click on either Item A or Item C it will not fire the change event.

    I have tried manually reseting the selected item with selectfield.setItem, setData, select, and setRecord but the symptoms are all the same.

    Is there some way to call the Select object's base functionality after I have processed the newValue?

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66

    Default

    This is really becoming a problem. I've tried to create a small reproducable case but the issue doesn't repro. I am systematically removing all events that are caught by the system to see if what might be causing this but it is a slow process.

    Any suggestions for how to track this down would be greatly appreciated.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66

    Default

    Looking at this in the debugger it appears that there are some conditions under which

    setLastSelected(record);

    Does not update _lastSelected to the value of the current record but sets it to the current value of _lastSelected. This means that it always remains at its initial value which is the record at the top of the list.

  4. #4
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66

    Default

    I traced this from the very beginning of the process. It appears that _lastSelected is appropriately set in the first call. The problem is when you click on the trigger to open the picker the second time the record that is passed to this:

    /**
    * Returns <tt>true</tt> if the specified row is selected.
    * @param {Ext.data.Model/Number} record The record or index of the record to check
    * @return {Boolean}
    */
    isSelected: function(record) {
    record = Ext.isNumber(record) ? this.getStore().getAt(record) : record;
    return this.selected.indexOf(record) !== -1;

    Is the first record in the list, not the last selected value. That is what I am guessing is the issue but I haven't figured out where this callback is configured and why the record passed is wrong (if that is in fact the issue). Again any hints whatever would be greatly appreciated.

  5. #5
    Sencha User
    Join Date
    Feb 2012
    Location
    Mercer Island, WA
    Posts
    66

    Default

    Just updated to build 439 and this repros with it.

  6. #6
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,488

    Default

    Watching this thread and waiting for a reproducible test case.
    Aaron Conran
    @aconran

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •