Lazy repeat calculateItemHeight index is always un

2019-08-06 01:33发布

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

标签: onsen-ui
1条回答
混吃等死
2楼-- · 2019-08-06 02:25

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

查看更多
登录 后发表回答