Knockout Binding flickering browser and cursor

83 views
Skip to first unread message

Mani kishore

unread,
Aug 21, 2015, 1:23:26 AM8/21/15
to KnockoutJS
Hi All,

I am developing an chat application with KO. While binding the chat conversation, the browser is hanging till binding and the favicon, browser Refresh and cursor buttons are blinking for every message binding.

I've tried like making visible false by default and making visible after binding. But it didn't worked for me.

Here is the KO code for binding the messages

ko.utils.arrayForEach(data, function (item) {
                    var msgobj = new ViewMessagesObject();
                    msgobj.Chattype(item.Chattype);
                    msgobj.contactname(item.contactname);
                    msgobj.contactnum(item.contactnum);
                    msgobj.contactpic(item.contactpic);
                    msgobj.deliverydate(item.deliverydate);
                    msgobj.file(item.file);
                    msgobj.frompic(item.frompic);
                    msgobj.is_delivered(item.is_delivered);
                    msgobj.is_read(item.is_read);
                    msgobj.loader(item.loader);
                    msgobj.message(item.message);
                    msgobj.messageid(item.messageid);
                    msgobj.messgetype(item.messgetype);
                    msgobj.Pic(item.Pic);
                    msgobj.readdate(item.readdate);
                    msgobj.sentdate(item.sentdate);
                    msgobj.sentstatus(item.sentstatus);
                    msgobj.toname(item.toname);
                    msgobj.topic(item.topic);
                    msgobj.uploadopacity(item.uploadopacity);
                    
                    self.DisplayMessageCollection.push(msgobj);
}

How can i stop these flicker issue while binding.

I've attached a video that shows the flicker of favicon and refresh button.

Thanks in Advance..
ChatFlickering.swf

marks_01

unread,
Sep 24, 2015, 11:57:48 PM9/24/15
to KnockoutJS

The video seems to show that you are inadvertently "posting back" to the same page.  It's not at all obvious how, based on your description, but you should use a tool like Fiddler to verify.   I'm betting Fiddler will show that you're reloading the page or posting back to the page... then the actual URL and data from Fiddler can give you clues as to how/where it's happening.

Also, are those "buttons" or "hyperlinks" that you're clicking in the video?   Make sure the button type is button (not submit), make sure your hyperlinks are not navigating somewhere.  If you run javascript from a click event, make sure you return false to prevent the default behavior of navigating or submitting.


Reply all
Reply to author
Forward
0 new messages