1. #1
    Sencha User
    Join Date
    Sep 2008
    Location
    Zurich (CH)
    Posts
    155
    Vote Rating
    0
    ExtJSBeginner is on a distinguished road

      0  

    Question Programmatically Select Items in ItemSelector

    Programmatically Select Items in ItemSelector


    I have a question regarding the ItemSelector: is it possible to programmatically
    simulate a doubleclick on one of the Items? I've tried it by throwing a rowdoubleclick
    but the item concerned hasn't been moved to the "selection panel".

    Any ideas?

  2. #2
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638
    Vote Rating
    2
    CrazyEnigma is on a distinguished road

      0  

    Default


    Saki posted some code to select values from a store, but I didn't really see it in the ux.ItemSelector extended class, so I wrote my own function within ItemSelector. I basically modified the toFrom or fromTo code within the class.

    Hopefully, this will help you out.
    Code:
        setToValues: function (store) {
            this.suspendEvents(false);
            // Remove all records from the toStore...
            var toStore = this.toMultiselect.view.store;
            var fromStore = this.fromMultiselect.view.store;
            var records = [];
            for(var i = toStore.getCount()-1; i >= 0; i--)
            {
                var record = toStore.getAt(i);
                toStore.remove(record);
                fromStore.add(record);
            }
    
            this.fromMultiselect.view.refresh();
            this.toMultiselect.view.refresh();
            
            // Re-add to toStore...
            for(var i = 0; i < store.getCount(); i++)
            {
                var theRecord = store.getAt(i);
                var record = fromStore.getById(theRecord.id);
                if(record)
                {
                    records.push(record);                
                }
            }
            fromStore.remove(records);
            toStore.add(records);
    
            this.fromMultiselect.view.refresh();
            this.toMultiselect.view.refresh();
            this.resumeEvents();
            
            this.fireEvent("controlchange", this);
        },

Similar Threads

  1. Programmatically Select TreeNode
    By kgmoney in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 8 Feb 2013, 5:16 AM
  2. Itemselector:To add buttons to move(up/down) selected items
    By anilpasha in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Jan 2010, 1:48 AM
  3. Itemselector : select all
    By yegortitov in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 27 Nov 2009, 1:38 AM
  4. right items to be made draggable in itemselector box
    By misra123 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 25 Sep 2008, 3:22 AM
  5. select node programmatically.
    By xerifa in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 26 May 2008, 8:48 PM

Thread Participants: 1

Tags for this Thread