Closed geekdad1 closed 9 years ago
Hey @geekdad1,
Hmmm. When you look at your browser's developer console, do you see the request being made? Can you confirm that the deleted order isn't returned in the response? Setting cache
to false
should prevent Marco Polo from caching responses, so you should see a fresh request for every search.
I'm not a regular marcopolo user, in fact I've inherited this project, however here's what I know so far.
Here's what I did to test this.
I did a lookup on DP3006 which returned me a list of records from the database including one numbered DP30060. That is the one I selected from the drop down list, and then I deleted it. Then I went to the server and put some debug statements into the query program to capture what was being sent back on the next search.
Back in the browser I cleared out the search value and started typing it in again. When I start typing into the search field after I got to the second letter in this case DP, the search program was run and then the results logged to my debug logIn the returned query the record DP30060 was not part of the result string. I continued typing into the field until I had entered DP3006. I see queries sent to the server for DP3, DP30 and DP300. None of these queries return DP30060. However, when I debugged the formatItem function in macropolo, I see DP30060 being included as part of the drop down list.
Here is a snippet of the code in question:
// on page load, setup the jQuery Marcopolo script
// https://github.com/jstayton/jquery-marcopolo
$('#order').marcoPolo({
cache: false,
url: '/cgi-bin/admin/search-orders.cgi',
formatItem: function (data, $item) {
var linestyle = '';
if (data.state == "Unsent Invoice") { state = "Unsent"; }
else if (data.state == "Submitted Invoice") { state = "Viewed"; }
else if (data.state == "Paid Invoice") { state = "Paid"; }
else if (data.state == "INVALID") { state = "Super.."; }
else { state = data.state; }
// if you wish to turn cells a special color, uncomment the following line and grey-out to taste
if (state == "Super..") { linestyle = 'background-color:#eee;color:#555;'; }
return '<div style="display:block;width:100%"><div style="width:25px;border-right:2px solid #BBB;padding-right:3px;display:inline-block;' + linestyle + '">' + data.add_by + '</div><div style="width:60px;border-right:2px solid #BBB;padding-left:3px;padding-right:3px;display:inline-block;' + linestyle + '">' + data.siteid + '</div><div style="width:150px;border-right:2px solid #BBB;padding-left:3px;padding-right:3px;display:inline-block;' + linestyle + '">' + data.name + '</div><div style="width:70px;border-right:2px solid #BBB;padding-left:3px;padding-right:3px;display:inline-block;' + linestyle + '">' + data.reference_number.toUpperCase() + '</div><div style="width:150px;border-right:2px solid #BBB;padding-left:3px;padding-right:3px;display:inline-block;' + linestyle + '">' + data.email_address + '</div><div style="width:130px;border-right:2px solid #BBB;padding-left:3px;padding-right:3px;display:inline-block;' + linestyle + '">' + data.created_date + '</div><div style="width:50px;padding-left:3px;display:inline-block;' + linestyle + '">' + state + '</div></div>';
},
onSelect: function (data, $item) { // if record is selected, fill the proposal/invoice with data
…
}
});
$('input,select').keypress(function(event) { return event.keyCode != 13; });
From: Justin Stayton [mailto:notifications@github.com] Sent: Wednesday, March 04, 2015 3:18 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
Hey @geekdad1 https://github.com/geekdad1 ,
Hmmm. When you look at your browser's developer console, do you see the request being made? Can you confirm that the deleted order isn't returned in the response? Setting cache to false should prevent Marco Polo from caching responses, so you should see a fresh request for every search.
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-77140866 . https://github.com/notifications/beacon/AKxu9CekC6fF9cSJTPcTzrJT_09hBcH_ks5nxuFfgaJpZM4Do6Ku.gif
Hey @geekdad1,
Do you know which version of Marco Polo you're using? It should be listed at the top of the JS file. I ask because there was a bug in versions prior to 1.4.0 where cache
set to false
didn't work.
Sorry about the delay. Your notification got into my junk email and I missed it. I don't see a version # in the file. Here is what I see in the head section.
I updated my copy of marcopolo. Here is what is in the top of the file now. /*!
Unfortunately the problem still exists.
Here is the code that creates the marcopolo object; ('#order').marcoPolo({ cache: false, url: '/cgi-bin/admin/search-orders.cgi', formatItem: function (data, $item) { var linestyle = ''; ...
I can confirm that search-orders does NOT get called when I type in a query string that I have previously tried, or that is a subset of a previous query. ie. if I query DP30 and get a list of items, when I query DP3006 I get a short list, but not by querying the database. When I request the same info as a previous query, I don't see a call to the server happening.
Hey @geekdad1,
Sorry for the delay.
I put together an example to test both caching enabled and disabled: http://codepen.io/jstayton/pen/pJRGRX
When I monitor the requests from my browser's developer tools, I see that caching disabled does in fact make a request for a previously searched term. In other words, it works as expected.
If you're still experiencing this issue, could you put together an example using CodePen or similar? I haven't been able to reproduce otherwise.
Thanks!
I've set up a page on my server you can play with.
http://medinetpay.ca/cachetest.htm
Type in a search item: loblaw
Pick an item from the list. Make a note of the number in the fourth column Starts with DP.
Click on the delete order button. Click on OK to delete the order.
Go into the search field and remove the last letter( the w). You should see the deleted item drop from the list.
Add the w back in. That item shows up again in the list.
I also put some logging into the script that runs on the server. It runs the search for loblaw the first time, but never again. It runs the search everytime when you remove the w but not when you put it back in.
Running query for loblaw
DP30101
DP30100
DP30099
DP30098
DP30097
DP30096
DP30095
DP30094
DP30093
DP30092
Running query for lobla
DP30101
DP30100
DP30099
DP30098
DP30097
DP30096
DP30095
DP30094
DP30093
DP30092
Running query for lobla
DP30101
DP30100
DP30099
DP30098
DP30097
DP30096
DP30095
DP30094
DP30093
DP30092
Running query for lobla
DP30101
DP30099
DP30098
DP30097
DP30096
DP30095
DP30094
DP30093
DP30092
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Monday, June 01, 2015 4:32 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
Hey @geekdad1 https://github.com/geekdad1 ,
Sorry for the delay.
I put together an example to test both caching enabled and disabled: http://codepen.io/jstayton/pen/pJRGRX
When I monitor the requests from my browser's developer tools, I see that caching disabled does in fact make a request for a previously searched term. In other words, it works as expected.
If you're still experiencing this issue, could you put together an example using CodePen or similar? I haven't been able to reproduce otherwise.
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-107407708 . https://github.com/notifications/beacon/AKxu9LlC9kHSPJD0cT6kPvJiJCc1dxP2ks5oPDowgaJpZM4Do6Ku.gif
Hi Doug,
I get prompted for authentication when I try to search on that page.
Are you using http not https. I tried it out here with several different machine and didn't get asked. Please try it again and let me know.
http://medinetpay.ca/cachetest.htm
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Wednesday, June 03, 2015 4:08 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
Hi Doug,
I get prompted for authentication when I try to search on that page.
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-108299952 . https://github.com/notifications/beacon/AKxu9GD8oJMu6HRxDpCzKcFlMgqeGJvIks5oPtd3gaJpZM4Do6Ku.gif
Yep, here's what happens:
That’s what should happen. Type in loblaw into the search box.
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Wednesday, June 03, 2015 8:48 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
Yep, here's what happens:
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-108493157 . https://github.com/notifications/beacon/AKxu9OCVfgH4eabIruCqYEP-pkUag_RCks5oPxlIgaJpZM4Do6Ku.gif
OK, I searched for loblaw
and the same thing happened. I don't understand why that's what should happen?
Let me explain.
When you search on loblaw you get a list of records. If you click on one of them (make a note of the ID in column 4), you get a copy of the invoice displayed. There is a button on the invoice that allows you to delete it. Click on the delete button.
That invoice is now gone. If you go back to the search box (where the word loblaw shows) and you make any changes. ie you delete the w. There is a new list that appears, without the deleted invoice. That is how it should work.
However if you type in the w again, you get the original list which includes the deleted invoice. It somehow pulls it out of a cache and never issues another search request. If it did then the deleted invoice would not appear.
Does that help?
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Wednesday, June 03, 2015 10:39 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
OK, I searched for loblaw and the same thing happened. I don't understand why that's what should happen?
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-108541101 . https://github.com/notifications/beacon/AKxu9GfXcAkmFgBTDSdSJfmYP1jOMDXeks5oPzNOgaJpZM4Do6Ku.gif
As soon as I search for loblaw
, I get the "Authentication Required" popup that you see in the GIF above. I don't even get to the seeing a list of records part.
Sorry. My fault. Please try this again. You will need to refresh the page before you do.
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Wednesday, June 03, 2015 11:50 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
As soon as I search for loblaw, I get the "Authentication Required" popup that you see in the GIF above. I don't even get to the seeing a list of records part.
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-108572358 . https://github.com/notifications/beacon/AKxu9EGeawom5I61Trj4kHBwgg5UpiVUks5oP0PYgaJpZM4Do6Ku.gif
No worries.
I ran through your instructions twice in Google Chrome. Both times after deleting an invoice, I searched again and the invoice was no longer in the results for loblaw
. I also see that a request is being made, which wouldn't happen if the results were being pulled from the internal cache. In other words, it's working as expected, but doesn't align with what you're experiencing.
What OS / browser version are you using? Perhaps it's related to that.
I'm running IE 11 running on a windows 7 desktop.
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Thursday, June 04, 2015 3:45 AM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
No worries.
I ran through your instructions twice in Google Chrome. Both times after deleting an invoice, I searched again and the invoice was no longer in the results for loblaw. I also see that a request is being made, which wouldn't happen if the results were being pulled from the internal cache. In other words, it's working as expected, but doesn't align with what you're experiencing.
What OS / browser version are you using? Perhaps it's related to that.
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-108836644 . https://github.com/notifications/beacon/AKxu9IGskzMa_ZWQlqvqvQEf5oDyVr6hks5oQCPDgaJpZM4Do6Ku.gif
Hi Doug,
I just tried IE 11 on Windows 7 (using BrowserStack, since I don't have access to that setup otherwise), and everything worked as expected. I followed your directions precisely, and never saw the deleted invoice in the search results again (for lobla
or loblaw
).
Ok. Well I don't know what's going on then. I guess it's a configuration issue in the browser somewhere. Thanks for your time with this.
Doug
From: Justin Stayton [mailto:notifications@github.com] Sent: Friday, June 05, 2015 2:30 PM To: jstayton/jquery-marcopolo Cc: geekdad1 Subject: Re: [jquery-marcopolo] Clearing the cache (#30)
Hi Doug,
I just tried IE 11 on Windows 7 (using BrowserStack https://www.browserstack.com , since I don't have access to that setup otherwise), and everything worked as expected. I followed your directions precisely, and never saw the deleted invoice in the search results again (for lobla or loblaw).
— Reply to this email directly or view it on GitHub https://github.com/jstayton/jquery-marcopolo/issues/30#issuecomment-109445524 . https://github.com/notifications/beacon/AKxu9AfN3ks-DjHmvr5CFblK18n1ux8Xks5oQgxXgaJpZM4Do6Ku.gif
I'm using this to query a database for a list of orders. One of my options is to delete the order. Once the order is deleted I don't want it to show in the list any more. However nothing I seem to do makes that happen. Setting the cache to 'false', or 0 doesn't affect it. Refreshing the page doesn't affect it. How do I force marcopolo to refresh it's cache?