This is a migrated thread and some comments may be shown as answers.

highlight list item and scroll to it

1 Answer 227 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
RICHARD FRIEND
Top achievements
Rank 2
RICHARD FRIEND asked on 15 Jul 2013, 11:36 AM
Hi

I currently use this code to highlight a list item (after updating) - however i would like to scroll (smoothly if possible) to the item as well as highlighting it.



Is there an elegant way to scroll the listview to a specific item, ive tried scrollIntoView of the html element but it messes up my fixed headers.


highlightRow: function (listView, field, value)
        {
            setTimeout(function () {
                var items = listView.items();
                for (var i = 0; i < items.length; i++) {
                    var ele = $(items[i]);
                    var uid = ele.data('uid');
                    if (pev.isGoodString(uid)) {
                        var item = listView.dataSource.getByUid(uid);
                        if (item != null && typeof item != 'undefined' &&
                            item[field] == value) {
                            ele.find('.list-item').highlight();
                             
                        }
                    }
                }
            }, 500);
        }
 
 
jQuery.fn.highlight = function () {
 
        $(this).each(function () {
            var el = $(this);
            el.before("<div/>")
            el.prev()
                .width(el.width())
                .height(el.height())
                .css({
                    "position": "absolute",
                    "background-color": "#ffff99",
                    "opacity": ".7"
                })
                .fadeOut(3000);
        });
    }

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 15 Jul 2013, 12:50 PM
Hi Richard,

The Kendo UI ListView does not have native item rendering or default scrolling behavior, that's why the described functionality is unfortunately not supported and should be achieved with a custom implementation.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
RICHARD FRIEND
Top achievements
Rank 2
Answers by
Dimo
Telerik team
Share this question
or