« first day (47 days earlier)      last day (160 days later) » 

3:27 PM
@EBrown Greetings
 
By the way pings don't work like that.
You have to send an invite for it to notify the other user.
Unless they are already in the room.
 
I have no idea how to do that
But anyway
Explain me a bit more the problem you have
 
I need the browser to execute the following line, then actually display the changes before the loop starts:
$("#searchingResultsFound").eq(0).html(items.length + " results found. Please wait while we render your items.");
 
I have 4 questions:
1 - Does $("#searchingResultsFound") return a length of 1?
2 - Why .eq(0)? You have an #id. If you have multiple elements with that ID, change it now
3 - Does the loop take some time to execute?
4 - If there any error in your console?
 
1. Irrelevant.
2. Irrelevant.
3. Yes, which is why I need it to update immediately.
4. No.
 
3:34 PM
Point 1 and 2 are extremelly important
If you have more than 1 element with id searchingResultsFound, it won't work
 
I do not, but the fact that I use .eq(0) is irrelevant.
I want a guarantee that I only have one item.
 
Then you are doing it wrong
Using the id selector will select the very first element with the matching id
If you want to guarantee you only have 1 element, and you are using an id selector, your HTML has serious issues
 
Yes, and using .eq(0) guarantees I only have one element.
Because I don't trust JavaScript, JQuery, or anything about it.
 
Using .eq(0) is both a waste and makes anyone think that your HTML is broken
And yes, repeated id's are invalid, rendering the whole document as broken and invalid
 
I know. If all you are going to do is complain about eq(0) then I've no use for you.
It's there. It's staying there. End of story.
 
3:41 PM
Are you using repeated ids?
 
Nope.
 
Do you have your code inside a $(function(){ [...] })?
 
        function OnItemsDownloadSuccess(response) {
            var xmlDocument = $.parseXML(response.d);
            var xml = $(xmlDocument);
            var items = xml.find("Table1");
            var i = 0;
            //alert(response.d);

            if (items.length > 0) {
                $("#searchingResultsFound").eq(0).html(items.length + " results found. Please wait while we render your items.");

                while (i < items.length) {
                    var item = $(items[i]);
Of which items can be anywhere from 0 to 3000+ elements.
Then, within that loop, it either removes the row, or it adds data to about 20 elements.
                        row.attr("id", "search-" + item.find("Number").text());
                        $(".item-awp", row).eq(0).html(item.find("AWP").text());
                        $(".item-brand-name", row).eq(0).html(item.find("BrandName").text());
                        $(".item-category", row).eq(0).html(item.find("Category").text());
Etc.
 
Try adding a setTimeout(function(){ ... }, 1) on your code
 
@IsmaelMiguel And why would I do that?
 
3:47 PM
And make a copy of whatever you need to change and shove it inside a DocumentFragment. Manipulate that and then you change the HTML of your table or whatever
@EBrown By doing that, you let the function finish and return, without grinding. Also, it gives time to render whatever the browser has to
It is something that can and should be done assyncronously (misspelled?)
 
It should be as non-blocking as possible, as there is a modal to indicate progress.
 
And the way I told doesn't work?
 
Wrapping the entire function in setTimeout doesn't work.
Still blocks.
 
I may have something for you
2
Q: Function queue for synchronous execution

Ismael MiguelThe purpose of this code is to allow to add functions to a queue, that will execute them sequentially. With this in mind, it also allows to execute them with a defined delay, to prevent them from blocking the browser. (function(window, undefined){ 'use strict'; var queue = []; var r...

You could give it a try
 
I don't need more bulk.
 
3:58 PM
It's an idea
 
If I can't make this work, I can't make it work.
 
You could add each update with a small delay (a few ms)
 
Oh well, I can improve this later. It works (for now).
 
4:15 PM
If you have any doubt, ping me
Sorry the delay, I had to leave in an emergency
 

« first day (47 days earlier)      last day (160 days later) »