tvos - TVML Add items dynamically? -


i have seen question (force view reload tvml content on apple tv/tvos) , answer describes how remove things dom there way add them?

i know standard appendchild on nodelist how create proper element appended? is, when create document in tvml special xml syntax parsed document. there way parse portion of document can add into, section within shelf dynamically add more items row after document has been presented?

p.s. i've tried using presenter.parser.parsefromstring() xml new item throwing ikdomexception syntax.

there many approaches can take accomplish adding items dynamically. important thing note apple's sample code not structured dynamic data well.

after create template, can change document in variety of ways. should have ownership of document after template created. in following example, variable doc contains stack template document i'd manipulate.

  var shelves = doc.getelementsbytagname("shelf"); //get shelves   var shelftoaddto = shelves.item(0); //choose index shelf want add to.   var sectiontoadd = `<section>             <lockup>             <img src="pathtoimg" width="100" height="100"/>             <title>title goes here</title>             </lockup>              </section>`;   shelftoaddto.insertadjacenthtml('beforeend', sectiontoadd); //this add new section before </shelf> tag. 

this add new section , lockup first shelf in document.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -