Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to keep track of an item in a 2D array (think along the lines of cell with focus).

However I am either very sleepy or incapable of googeling a good answer.. (or both)...

here is roughly what I was trying to do:
JavaScript
   function ViewModel() {
    var self = this;
    self.data = get2Darray();
        self.currentItem = {???};
    self.itemDetails = ko.computed(function () {
        return self.currentItem.blah +self.currentItem.blah2;
    });
        self.getNext = ko.computed(function () {
        self.currentItem = self.data(--{Next}--);;//???
    });
};
ko.applyBindings(new ViewModel());

with html:
HTML
<div  class='mazeRow' data-bind="foreach: data" >
     <div data-bind="attr: { 'class': fuzzy }"></div>
</div>
<input type="button" id="Button3" 
       data-bind="click: btn_Click, enabled: currentItem.enabled"        
       value="FraggelRock"/>

<input type="button" id="Button4"  data-bind="click: getNext" value="move Next"/>


What am I doing wrong?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900