Lazy repeat calculateItemHeight index is always undefined

647 views Asked by At

I'm using ons-lazy-repeat and I want to have variable item heights depending on the item.

For that I'm using, as described in the documentation, a delegate object with a calculateItemHeight function.

The problem is all item heights are being set to 20 because initially the index variable is always undefined. Afterwards everything seems to work correctly but everything is already rendered on the ui.

Anyone else have the same problem? I don't see what I'm doing wrong here.

This is my delegate object:

   $scope.TransactionDelegate = {
    configureItemScope: function(index, itemScope) {
        itemScope.item = TransactionService.allTransactions[index];
    },
    calculateItemHeight: function(index) {
        if (!index)
            return 20;

        return 60;
    },
    countItems: function() {
        return TransactionService.allTransactions.length;
    },
    destroyItemScope: function(index, scope) {
        ;
    }
  };

Thanks

1

There are 1 answers

1
FilipeFreitas On BEST ANSWER

This is a know bug that is now fixed and will be released in the next version.