qml - How to get listview position in Blackberry 10 native -


i trying load data web-services list-view , able load particular data list-view.

but problem facing getting 10 data per page in list-view , when user scroll down tries load more data , when loads more data list-view, list-view start showing data 1st data itself, instead of 1st data want show current data.

ex. when user scrolls more data page - 2 load 10 data , list-view contains 20 data, user @ 10th position , loading more data list-view should show 11th data instead of again start 1st data itself, when user loads 30 data should start showing data 21 data again starting 1st position.

so question how can know position of list-item , directly moves user particular position directly user can see current data.

the code trying is.

onscrollingchanged: {               if (atend && scrolling == false                    if (_app.powerdivert == 1) {                           _app.powerdivert += 1;                     }                     if (conninfo.isconnected()) {                               getpagewisepromotionlist(_app.powerdivert);                     }                  }              } 

where powerdivert increment page-count , getpagewisepromotionlist function calling add more data list-view.

i have tried.

  onfirstvisibleitemchanged: {             if (position < firstvisibleitem) {              console.log("scrolling down")              var size = _app.datamodel.size();              var percent = firstvisibleitem / size * 100;              console.log("percent: " + percent);                   if (percent > 60) {                             if (_app.powerdivert == 1) {                             _app.powerdivert += 1;                            }                            if (conninfo.isconnected()) {                                console.log("inside percentage");                                getpagewisepromotionlist(_app.powerdivert);                            }                        }                       } else if (position > firstvisibleitem) {                        console.log("scrolling up");                     }                    position = parseint(firstvisibleitem);                 } 

and code

onscrollingchanged: {         if (listitem.indexinsection + 5 == listitem.indexpath) {                if (_app.powerdivert == 1) {                       _app.powerdivert += 1;                 }                if (conninfo.isconnected()) {                        getpagewisepromotionlist(_app.powerdivert);               }          } } 

but it's giving me error like

error: accessing listitem.indexinsection on node not root node in list item visual. try prefixing id of item visual root node. error: accessing listitem.indexpath on node not root node in list item visual. try prefixing id of item visual root node. 

please let me know if need else.

thank in advance.

that depends on you.how loading data services.if getting data page wise can use this:

var indexposition = (_app.powerdivert - 1) * 10; lstpromotionlistonline.scrolltoitem([ indexposition ], scrollanimation.none); 

where powerdivert page_number , lstpromotionlistonline listview id

check link reference.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -