Guest User

Untitled

a guest
Oct 19th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. // init db
  2. var procTech = TAFFY();
  3.  
  4. //..... other code in the middle
  5.  
  6. procTech().remove();
  7. var x = 0;
  8. $(".sxRow select[id^='KRCtech_']").each(function() {
  9. var techName = $(this).val();
  10. x++;
  11. var xStr = x.toString();
  12. clog(xStr + " " + techName);
  13. procTech.insert({"count":xStr,"tech":techName });
  14. });
  15.  
  16. var ret = eval(procTech().select("count","tech"));
  17. clog(ret.length);
  18. for (j = 0; j <= ret.length - 1; j++) {
  19. clog("read back: " + [j][0] + "," + [j][1]);
  20. }
  21.  
  22. // wrapper for console.log
  23. function clog(s) {
  24. window.console && console.log(s);
  25. return;
  26. }
  27.  
  28. 1 tonya
  29. 2 shawn
  30. 2
  31. read back: 0,undefined
  32. read back: 1,undefined
  33.  
  34. procTech.insert({"count":1,"tech":'techName' });
  35. procTech.insert({"count":2,"tech":'techName1' });
  36. procTech.insert({"count":3,"tech":'techName2' });
  37. procTech.insert({"count":3,"tech":'techName2' });
  38. procTech.insert({"count":3,"tech":'techName2' });
  39. procTech.insert({"count":4,"tech":'techName3' });
  40.  
  41. var query = procTech.select("count","tech"); // 3 rows
  42.  
  43. for ( var x=0; x<query.length-1; x++ ) {
  44. console.log(query[x][0], query[x][1]);
  45. }
Add Comment
Please, Sign In to add comment