question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vs-excess not doing it's job

See original GitHub issue

I’m attempting to use vs-excess in order to ensure enough items are in DOM to work around the virtual momentum scrolling issue. #40

Problem is, vs-excess is just not doing it’s job. No excess items are ever in DOM. Ideas?

HTML ANGULAR CODE
        <!--GRID VIEW-->
        <div vs-repeat class="inner-container" vs-excess="50" vs-size-property="rowHeight" vs-offset-before="77" on-vs-index-change="infiniteScroll(startIndex, endIndex)" ng-show="views.gridView">
            <div ng-repeat="row in results.gridRows" style="width: 100%;">
                <div ng-repeat="result in row.rowContents"
                     ng-click="openSplash(this)"
                     class="grid-item"
                     style="width: {{results.gridPercentageWidth}}%;"
                        >

                    //Add html here
                </div>
            </div>
        </div>
JS CODE TO CALCUALTE AND BUILD RESPONSIVE GRID
factory.generateRows = function (results, reason, views) {

        var numColumns;

        //If user has gridView enabled calculate columns, else build list view.
        if (views.gridView) {
            var dimensions = factory.getInnerContainerDimensions();
            var itemWidth = 290;
            //console.log('width: ' + dimensions.w + '/' + itemWidth + ' equals...');
            numColumns = Math.floor(dimensions.w / itemWidth);
            factory.results.gridPercentageWidth = 100 / numColumns;
            //console.log("Calculated " + numColumns + " columns at " + factory.results.gridPercentageWidth + "% width.");
        } else {
            numColumns = 1;
            //console.log("List View: " + numColumns + " columns!");
        }



        if (numColumns !== factory.cachedColumnCalculation || reason === 'filter' || reason === 'pagination') {

            factory.cachedColumnCalculation = numColumns;

            //TODO: Don't clear all items just clear necessary ones??
            factory.results.gridRows = [];

            //Calculate the number of results with images and add up scroll height. This is used for virtual scrolling
            for (var i = 0; i < results.length; i++) {

                var rowHeight;

                //If gridview is turned on they height is always 350
                if (views.gridView) {
                    rowHeight = 390;
                } else { //else the user is in list view.  Height depends on whether result contains 2 or more images.
                    if(results[i].images.length === 0) {
                        rowHeight = 179;
                    } else if (results[i].images.length === 1) {
                        rowHeight = 261;
                    } else {
                        rowHeight = 420;
                    }
                }


                if (i % numColumns === 0) {
                    var row = {
                        rowHeight: rowHeight,
                        rowContents: []
                    };

                    for (var j = 0; j < numColumns; j++) {

                        if (i + j < results.length) {
                            //console.log(i + j);


                            if (results[i + j].askingPrice.value) {
                                factory.updatePriceSlider(results[i + j].askingPrice.value);
                            }


                            row.rowContents.push(results[i + j]);
                        }
                    }

                    factory.results.gridRows.push(row);

                    i = i + j - 1;
                    //console.log('Finshed row! New index is: ' + i);
                }
            }

            console.log('Grid Rows: ', factory.results.gridRows);

        }

    };

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
quietmintcommented, May 27, 2015

Had the same problem with 1.0.0-rc5. Ended up fixing this by adding the following to updateInnerCollection() at line 387 (right before var digestRequired definition):

$scope.startIndex = Math.max(($scope.startIndex - $scope.excess), 0);
$scope.endIndex = Math.min(($scope.endIndex + $scope.excess), originalLength);
0reactions
that1guycommented, Jun 9, 2015

Resolved. Thank you!

On Tuesday, June 9, 2015, mato75 notifications@github.com wrote:

is this issue still present @that1guy https://github.com/that1guy ?

— Reply to this email directly or view it on GitHub https://github.com/kamilkp/angular-vs-repeat/issues/41#issuecomment-110365572 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

20 Signs You're Overworked and Underpaid | Indeed.com
A key sign that you're overworked is if you've lost the passion you once felt for your position. If you no longer look...
Read more >
Are You Being Taken Advantage of at Work? | Monster.com
Feeling unappreciated or like you're constantly being taken advantage of at work is absolutely not in anyone's job description. Cue the stress headaches....
Read more >
Job burnout: How to spot it and take action - Mayo Clinic
Consequences of job burnout​​ Ignored or unaddressed job burnout can have significant consequences, including: Excessive stress. Fatigue. Insomnia.
Read more >
How to Say No to Taking on More Work
Sometimes you have too much on your plate or you're just not interested in taking on a project you've been asked to work...
Read more >
7 Health Effects of Working Too Much - Healthline
Excessive stress can leave you feeling physically and mentally exhausted — even after 9 hours of sleep. You might find that it's taking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found