{"id":1756,"date":"2022-08-30T15:19:11","date_gmt":"2022-08-30T15:19:11","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/01\/how-to-add-dojox-mvc-output-to-dojox-mobile-listitem-programmatically-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:19:11","modified_gmt":"2022-08-30T15:19:11","slug":"how-to-add-dojox-mvc-output-to-dojox-mobile-listitem-programmatically-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-add-dojox-mvc-output-to-dojox-mobile-listitem-programmatically-collection-of-common-programming-errors\/","title":{"rendered":"how to add dojox.mvc.Output to dojox.mobile.ListItem programmatically?-Collection of common programming errors"},"content":{"rendered":"<p>I want to add a label and value for ListItem programmatically how do i do it? I do not want to use rightText for ListItem.<\/p>\n<pre><code>     \/\/   widgetId = \"showUrl\"\n     dojo.empty(widgetId);\n\n     var listItem = registry.byId(widgetId);\n     if (listItem != undefined)\n          listItem.destroy(true);\n\n     listItem = new ListItem({}, widgetId);\n\n     var labelOutput = dom.byId(\"urllabel\");\n     if (labelOutput == undefined) {\n         labelOutput = dojo.create(\"div\", {id: \"urllabel\"}, listItem.srcNodeRef);\n     }\n     console.log(\"labelOutput \", labelOutput);\n     var output = new mvc.Output({ref: labelItem\n                          }).placeAt(labelOutput);\n     console.log(\"output \", output);\n     \/\/output.startup();\n<\/code><\/pre>\n<p>}<\/p>\n<p>I tried the above code and it doesn&#8217;t show me the label url in ListItem.<\/p>\n<ol>\n<li>\n<p>Just bumped into this page. In case if using Dojo 1.8 is an option &#8211; Dojo 1.8 allows to establish data binding right to dojox\/mvc\/ListItem&#8217;s <code>label<\/code> attribute, which is the text in ListItem, with dojox\/mvc\/at API. So you can do something like:<\/p>\n<pre><code>var labelItem = new Stateful(); \/\/ dojo\/Stateful\nregistry.byId(\"li\").set(\"label\", at(labelItem, \"value\"));\nlabelItem.set(\"value\", \"The text\");\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-01 03:07:56. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I want to add a label and value for ListItem programmatically how do i do it? I do not want to use rightText for ListItem. \/\/ widgetId = &#8220;showUrl&#8221; dojo.empty(widgetId); var listItem = registry.byId(widgetId); if (listItem != undefined) listItem.destroy(true); listItem = new ListItem({}, widgetId); var labelOutput = dom.byId(&#8220;urllabel&#8221;); if (labelOutput == undefined) { labelOutput = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1756","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1756"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1756\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}