Knockout Mapping Plugin - Capture Array Value
===

I have a JSON array coming from a REST API.   I am using the Knockout mapping plugin to process the array and load the JSON into preset form values (if a user has added values to the form previously - I have data there to test the Knockout arrays).  The form essentially adds or deletes div blocks with inputs so users can add/delete "work" experiences.

My trouble is with trying to decipher how the plugin maps the arrays.  I am trying to locate a specific value (the id) of a row in the array so I can add it as a variable to tell the API to delete that specific row.  I can get Knockout to explicitly output the row value in the html, but I can't figure out how to capture it otherwise.  In the template "foreach" I have a button that references a "remove:" and that's where I'm stuck in trying to capture the value from the array.

For Example in the HTML:

This outputs the two rows of the "work" object no problem:

    <span data-bind="text: ko.mapping.toJSON(workModel.work())"></span>

    [{"id":"1","schoolID":"2","place":"","position":"Science Teacher","description":"I worked at ASD for 1 year as a Science teacher.","start":"2011","end":"2012","profileID":"91"},{"id":"2","schoolID":"1","place":"American School of Taiwan","position":"Science Guy","description":"I was just another science guy","start":"2008","end":"2011","profileID":"91"}]

This outputs the id of the first row and item in the array:

    <span data-bind="text: ko.mapping.toJSON(workModel.work()[0].id)"></span>
    "1"

But in the javascript, if you click on the remove button generated by the foreach template...

    gone = function(work) {
    	      
    	 	alert(ko.mapping.toJSON(workModel.work(this).id)); 
    	    
    	 } 

Gives me this error in Firebug, and then the UI reloads and drops out the template block I just clicked on.

    Unable to parse bindings. Message: TypeError: workModel.work()[0] is undefined; Bindings value: text: ko.mapping.toJSON(workModel.work()[0].id)



Even though, if I replace the above alert with the explicit statement:

    gone = function(work) {
        	      
        	 alert(ko.mapping.toJSON(workModel.work()[0].id)); 
        	    
        	 } 

I get the correct value of "1" again.  I know it has to do with the "this" aspect of the code, but I'm not sure what the mapping plugin is doing so that I can capture the specific value from the array...make sense?  Any help would be greatly appreciated.