Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

dxList - How to scroll to a specific item

$
0
0

dxList does not provide any API that allows scrolling to an item. We can create a dxList inheritor and add the required functionality. This example demonstrates how to add the dataBound event and a method that scrolls content to a specific item index.

[JScript]
var MyList = DevExpress.ui.dxList.inherit({ _render: function(){this.callBase();if(this._dataSource){if(this._dataSource._isLoaded && $.isFunction(this.option("dataBound")))this.option("dataBound")(this);}}, scrollToItemIndex: function(index){var elements = this._items();if(elements.length < index || index < 0)return;var itemHeight = elements[0].offsetHeight;this._scrollView.scrollPos(itemHeight * index, true);}}); DevExpress.ui.registerComponent("myList", MyList);

We handle the dataBound event and call the scrollToItemIndex method that was added to our inheritor.

See also:
DevExpress.ui.registerComponent


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>