Results 1 to 9 of 9

Thread: PIcker selection functionality

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default PIcker selection functionality

    I'm creating a custom picker that dynamically loads data to three slots. Each slot requires the selection of the preceding slot. This works great by actually tapping on the item in the slot, however the problem is when sliding or rolling the selection without actually tapping it will not select the item. Is there a way to have a picker slot load a selection wether or not you actually 'tap' the item?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    So you want to programmatically select a value in a slot?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default

    No. What I mean is when using the Picker you it will only select the selection if the selection is actually tapped on in the slot. If the user tries to just slide using vertical swipe, the selection, even though highlighted, is not selected. Most users just slide the slot and don't tap the slot selection. I hope that makes more sense. Thank you kindly for your help!

  4. #4
    Sencha Premium Member
    Join Date
    May 2011
    Posts
    71
    Vote Rating
    6
      0  

    Default

    You could try listening for the dragend event on the slot div.

    Code:
    var myPicker = Ext.ComponentQuery.query('mypicker');
    var slot = myPicker.down('#slotID');
    var el = slot.element;
    
    var onDragend = function(...) {
    ...
    };
    
    el.addListener('dragend', onDragend);

  5. #5
    Sencha User
    Join Date
    Oct 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Beautiful! That makes total sense. I'll try that...

  6. #6
    Sencha User
    Join Date
    Oct 2012
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.

  7. #7
    Sencha User
    Join Date
    Oct 2012
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by simsimmal View Post
    Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.
    Good question, I'm not sure about that. I looked that up too and didn't see anyway to set the picker or picker slot selection. Please post back if you find an answer to that.

  8. #8
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Vote Rating
    1272
      0  

    Default

    Quote Originally Posted by simsimmal View Post
    Hello, i'am trying to programmatically select a value in a slot? Seems i'am missing something in the docs. Please give me a hint.
    Here is an example (code in red is the important snippet):

    Code:
    var picker = Ext.create('Ext.picker.Picker', {
        slots : [
            {
                name  : 'speed',
                title : 'Speed',
                data  : [
                    { text : '50',  value : 50  },
                    { text : '100', value : 100 },
                    { text : '200', value : 200 },
                    { text : '300', value : 300 }
                ]
            },
            {
                name  : 'unit',
                title : 'Unit',
                data  : [
                    { text : 'KB/s', value : 'kbps' },
                    { text : 'MB/s', value : 'mbps' }
                ]
            }
        ]
    });
    
    picker.setValue({
        speed : 200,
        unit  : 'mbps'
    });
    
    Ext.Viewport.add(picker);
    picker.show();
    The setValue takes an object with the property being the name of the slot and the value being the value of the slot.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  9. #9
    Sencha User
    Join Date
    Oct 2012
    Posts
    10
    Vote Rating
    0
      0  

    Default

    so obvious,

    thanks a lot!

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
  •