max lenght content in list view

2 posts, 0 answers
  1. Manan
    Manan avatar
    5 posts
    Member since:
    Apr 2014

    Posted 26 Apr 2014 Link to this post

    Hi I am using kendo listview component as seen below:

    $("#showHide").kendoListView({dataSource: vals,template: "<div style='overflow: hidden;text-overflow: ellipsis;white-space: nowrap;margin:4px;'>#:name#</div>",selectable: "multiple",
    change:  function() {
    selected = $.map(, function(item) {
    return vals[$(item).index()].name;

    Is there any way that i can find the max lenght element of whole content. for example 
    1). asdf

    In this 3 element is largest.

    Please suggest if there is any way we can find the max length of all the elements.
  2. Alexander Popov
    Alexander Popov avatar
    1411 posts

    Posted 29 Apr 2014 Link to this post

    Hello Manan,

    Although this is not supported out of the box, it could be achieved by subscribing to the ListView's dataBound event. Once the event is triggered you could iterate over the currently displayed items through the DataSource's view method and check their length. For example: 
        function onDataBound() {
            var items = this.dataSource.view();
            for (var i = 0; i < items.length; i++) {

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top