How do you go about inserting an advertisement into a ListView. I can conditionally render my item templates and show an add in one, but I don’t want to replace an item with an ad. I can also drop a placeholder into my datasource, but then I have to account for that different item in a few places. Is there another way?
How do you go about inserting an advertisement into a ListView. I can conditionally
Share
The WinJS.Binding.List behaves like an array. So let’s say you have a list of 10 items, and you want to dynamically ad an advertisement at index “3”.
Let’s assume you have a variable defined already, named “list” that is your WinJS.Binding.List. You would do
That should automatically animate your listView to pop in a new element. If it doesn’t animate, try one of these http://msdn.microsoft.com/en-us/library/windows/apps/br229780.aspx, you probably want “createAddToListAnimation”. It’s extremely easy to make animations in WinJS.
I’m guessing your advertisement object would look like {message: “Join XXX today”} or something along those lines.