This project is read-only.

No results for callback()

Nov 15, 2012 at 2:43 PM
Edited Nov 15, 2012 at 7:29 PM

First off, amazing library. Thanks for all the work you've done. One small issue I encountered that I hope I have fixed below... In the unminified version, near line 260, there is a block that tests for totalResults being NaN and a paging object. Unfortunately, there is no logical operation within the block for returning a no results message. The modulo of 0/pageSize will never be greater than 0 and so the bit where pages gets incremented before parseInt(++pages) never fires off.

To fix this, I changed this block:

if (isNaN(totalResults) && o.paging) {
                ....
                totalResults = data[o.resultsProperty].length;          
                var pages = totalResults / pageSize;
                if (totalResults % pageSize > 0) pages = parseInt(++pages);

to the following:

if (isNaN(totalResults) && o.paging) {
                ....
                totalResults = data[o.resultsProperty].length;   
/*  added to correct no results fail - ajd 11/15/2012   */
                if(totalResults == 0) { 
                     data[o.totalProperty] = 0;
                     displayItems(data,q); // I can haz no results?
                }       
                var pages = totalResults / pageSize;
                if (totalResults % pageSize > 0) {
                     pages = parseInt(++pages);
                }

HTH,

al

Nov 15, 2012 at 10:44 PM

Thank you! Good catch on that one.

From: adeluca [email removed]
Sent: Thursday, November 15, 2012 11:47 AM
To: Noah Heldman
Subject: No results for callback() [flexbox:403332]

From: adeluca

First off, amazing library. Thanks for all the work you've done. One small issue I encountered that I hope I have fixed below... In the unminified version, near line 260, there is a block that tests for totalResults being NaN and a paging object. Unfortunately, there is no logical operation within the block for returning a no results message. The modulo of 0/pageSize will never be greater than 0 and so the bit where pages gets incremented before parseInt(++pages) never fires off.

To fix this, I changed this block:

if (isNaN(totalResults) && o.paging) {
                ....
                totalResults = data[o.resultsProperty].length;          
                var pages = totalResults / pageSize;
                if (totalResults % pageSize > 0) pages = parseInt(++pages);

to the following:

if (isNaN(totalResults) && o.paging) {
                ....
                totalResults = data[o.resultsProperty].length;   
/*  added to correct no results fail - ajd 11/15/2012   */
                if(totalResults == 0) { 
                     data[o.totalProperty] = 0;
                     displayItems(data,q); // I can haz no results?
                }       
                var pages = totalResults / pageSize;
                if (totalResults % pageSize > 0) {
                     pages = parseInt(++pages);
                }
 

HTH,

al