Retrieve record to be edited

Retrieve record to be edited

Hello:

So I had a function which builds a table in HTML for display on my html document. I wanted to take advantage of jQuery ListView, so I changed it from table to listview. This is the function:

  1. function fnShowClassesTable(data) { 
  2. var str = "<ul data-role='listview' data-inset='true'>";
  3. str += "<li data-role='list-divider' role='heading'>My Active Programs</li>"
  4. for(var i = 0; i < data.length; i++) {
  5. str += "<li class='btnEditProg'><a href='#' data-transition='slide'><h3>"  +                         data[i].doc._id +  "</h3><p id='listviewNoEllipsis'>" +                         data[i].doc.pDesc + "</p><p class='ui-li-aside'>" +                         data[i].doc.pStartDate  "</p></a></li>";
  6. }
  7. str += "</ul>";
  8. str += "<hr>";
  9. $elDivShow.html(str).trigger('create');
  10. $elDivShow.hide().fadeIn(250);
  11. }
Notice I am building the str variable with the HTML. Now, I also set up some other code to call an edit function when you click on a row in the listview (with the  <li class='btnEditProg'>). 

However, the code that was written previously was able to do a .find to populate the edit form is from when it was looking for a table, and it's keying off the <td>. So how would I change this part of my function to find those _id, pDesc, and pStartDate fields?

  1. function fnUpdateClassPrep(thisObj) { 
  2. console.log(thisObj);
  3. var $tmpProgName = thisObj.find("td:eq(0)").text(), 
  4. $tmpProgDesc = thisObj.find("td:eq(1)").text(),
  5. $tmpStartDate = thisObj.find("td:eq(2)").text(), 


Hope that makes sense. Thanks!