1. #1
    Sencha User
    Join Date
    Jun 2013
    Posts
    5
    Vote Rating
    0
    aram.dermenjian is on a distinguished road

      0  

    Default Unanswered: How to access KeyNav

    Unanswered: How to access KeyNav


    So I know each combobox in ExtJS has a boundlist that can be gotten by grabbing the picker (combobox.getPicker()) How does one access the BoundListKeyNav though in order to see which one of the items is highlighted and such?


    Here's what I'm trying to do:
    In my combobox I have a listConfig in which I inject an item before the list so that you in essence have something like the following:
    HTML Code:
        <div id="boundlist-1098-listEl" class="x-boundlist-list-ct" style="overflow: auto; height: 299px;">        <div class="my-boundlist-item-menu" style="cursor:pointer;padding:2px;border:1px dotted #fff" onmouseover="this.className='my-boundlist-item-menu x-boundlist-item-over'" onmouseout="this.className='my-boundlist-item-menu'">Add New Address</div>        <div class="x-boundlist-item" id="ext-gen1267">Item 1</div>        <div class="x-boundlist-item">Item 2</div>        <div class="x-boundlist-item">Item 3</div>        <div class="x-boundlist-item">Item 4</div>    </div>
    I figured out I can tell when I'm on the first element using the following:
    Code:
        Ext.get(combobox.getPicker().id).query('.x-boundlist-item-over')[0]).dom.viewIndex
    That helps get me the index (and since I know we have 5 items I can theoretically know which one is last). I need someway to be able to use the keyboard to go up and down and still be able to select the first element.


    Here's a JS fiddle to show a simple combobox: http://jsfiddle.net/Tyw34/1/ Notice how when you use the up/down keyboards it skips over the additional item I've added.


    Does anyone have any ideas on how to make it so that it doesn't just skip around like that? I can't seem to get it to stop the trigger and I can't figure out how to access the KeyNav to be able to do it.


    Thanks for any suggestions.

  2. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,681
    Answers
    130
    Vote Rating
    112
    tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all tobiu is a name known to all

      0  

    Default


    An Ext.view.BoundList is just an extension of Ext.view.View.
    http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.view.View

    you can call
    Code:
    myView.getSelectionModel().getSelection();
    (http://docs.sencha.com/extjs/4.2.1/#...d-getSelection)

    Best regards
    tobiu
    Best regards
    Tobias Uhlig
    __________

    S-CIRCLES Social Network Engine

Thread Participants: 1

Tags for this Thread