Translate

Scroll to a given item in a dataview - Sencha Touch

In my Sencha Touch app I had a component dataview. I had included an index bar and I needed to scroll to the relevant items when I click on index bar. This is what I did.

Here recordIndex is the index of the component in dataview that we need to scroll to.

9 comments:

  1. hey,
    Its not work for me
    I have this error Uncaught TypeError: Cannot read property 'element' of undefineditemsingletap

    ReplyDelete
  2. Can you post your code snippet here.

    ReplyDelete
    Replies
    1. ```itemsingletap: function(list, index, target, record, e, eOpts ) {


      p_scor_controller.ok = false;
      p_scor_controller.tap = true,
      p_scor_controller.scrollRecord = this.getViewItems()[index].element.getY();```

      Delete
    2. I have a list of people that when I click on a personage it displays its coordinates.
      I want me when I return in the person of the list, the scroll is until the person I click previously

      Delete
  3. Now, is "this" a data view? I think there is a problem in scope.

    ReplyDelete
    Replies
    1. you have idea what i need to do

      Delete
    2. Check here[1]. There is a function "scrollToSelectedItem" and it is working.


      [1] https://github.com/Raxa/doctorsnearme/blob/master/app/view/ContactList.js

      Delete
    3. you know why my list.getItemMap() function return Array with 0 element when my list have 13 element

      Delete