Thursday 15 March 2012

javascript - Uncaught Reference on '$root' -



javascript - Uncaught Reference on '$root' -

when test, $root throwing uncaught reference error. these files involved, allow me know if need more information. can't see i'm doing wrong.

is there need create $root available me? exclusive mobile apps only?

shows.js

velocitymeetings.shows = function (params) { var errormessage = ko.observable(""); var viewmodel = { errormessage: errormessage, errorvisible: ko.computed(function() { homecoming errormessage().length != 0; }), hideerror: function () { errormessage(""); }, resultsitemclick: function () { alert('ok') } }; homecoming viewmodel; };

shows.dxview

<div data-options="dxview : { name: 'shows', title: 'trade shows' } "> <div style="font-size: 11px;" class="shows-view" data-options="dxcontent : { targetplaceholder: 'content' } "> <br /> <img src="images/logo.jpg" /> <div style="color: red; margin: 5px; font-size: 12px;" data-bind="visible: errorvisible, text: errormessage"></div> <br /> <div style="font-size: 14px; color: rgb(98, 31, 137); font-weight: bold;">my shows</div> <br /> <div data-bind="dxlist: { datasource: shows }"> <div data-options="dxtemplate: { name: 'item' }, dxaction: $root.resultsitemclick" style=" style =" border: 1px solid lightgrey; padding: 15px; color black; width: 200px; margin: auto;"> <img data-bind="attr:{ src: image }" /><br /> <b><span data-bind="text: date"></span></b><br /> <b><span data-bind="text: location"></span></b> </div> </div> </div> </div>

i mixing data-options , data-bind attributes.

<div data-options="dxtemplate: { name: 'item' }" data-bind="dxaction: $root.resultsitemclick" style =" border: 1px solid lightgrey; padding: 15px; color black; width: 200px; margin: auto;">

thats template line should if struggling.

javascript cordova knockout.js devextreme

No comments:

Post a Comment