Hi All,
I am have some basic issue. I took the code straight from the jet cook book and used the same in my project. It is not working.
Following is the code:
videModel
---------
define(['ojs/ojcore', 'knockout', 'jquery', 'ojs/ojknockout','ojs/ojbutton'],
function (oj, ko, $) {
function IncidentsViewModel() {
var self = this;
self.button2Text = "Button 2";
self.clickedButton = ko.observable("(None clicked yet)");
self.buttonClick = function (event) {
self.clickedButton(event.currentTarget.id);
return true;
}
self.handleActivated = function (info) {
// Implement if needed
};
self.handleAttached = function (info) {
// Implement if needed
};
self.handleBindingsApplied = function (info) {
// Implement if needed
};
self.handleDetached = function (info) {
// Implement if needed
};
}
return new IncidentsViewModel();
}
);
views:
------
<div class="oj-hybrid-padding">
<h1>Incidents Content Area</h1>
<div id='buttons-container'>
<oj-button id='button1' on-oj-action='[[buttonClick]]'>Button 1</oj-button>
<oj-button id='button2' on-oj-action='[[buttonClick]]'>
<span><oj-bind-text value="[[button2Text]]"></oj-bind-text></span>
</oj-button>
<p>
<p id="last" class="bold">ID of last button to be clicked:
<span id="results"><oj-bind-text value="[[clickedButton]]"></oj-bind-text></span>
</p>
</div>
</div>
When, I click on "Button 1" or "Button 2" the results span does not get updated.
Please let me know what is going wrong here.
Thanks
#V.Chandrashekar