Best JavaScript code snippet using wpt
index.js
Source:index.js
1Controller = function()2{3 var grid, record;45 function createGrid()6 {7 var data = [8 {"company":"0. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":1,"_parent":null,"_level":1,"_lft":1,"_rgt":98,"_is_leaf":false},9 {"company":"1. American International Group, Inc.","price":64.13,"change":0.31,"pct_change":0.49,"last_change":"9\/1 12:00am","_id":2,"_parent":1,"_level":2,"_lft":2,"_rgt":17,"_is_leaf":false},10 {"company":"2. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":3,"_parent":1,"_level":2,"_lft":18,"_rgt":65,"_is_leaf":false},11 {"company":"3. The Coca-Cola Company","price":45.07,"change":0.26,"pct_change":0.58,"last_change":"9\/1 12:00am","_id":4,"_parent":1,"_level":2,"_lft":66,"_rgt":79,"_is_leaf":false},12 {"company":"4. Citigroup, Inc.","price":49.37,"change":0.02,"pct_change":0.04,"last_change":"9\/1 12:00am","_id":5,"_parent":null,"_level":1,"_lft":99,"_rgt":100,"_is_leaf":true},13 {"company":"5. Hewlett-Packard Co.","price":36.53,"change":-0.03,"pct_change":-0.08,"last_change":"9\/1 12:00am","_id":6,"_parent":null,"_level":1,"_lft":101,"_rgt":118,"_is_leaf":false},14 {"company":"6. McDonald's Corporation","price":36.76,"change":0.86,"pct_change":2.4,"last_change":"9\/1 12:00am","_id":7,"_parent":1,"_level":2,"_lft":80,"_rgt":85,"_is_leaf":false},15 {"company":"7. The Procter & Gamble Company","price":61.91,"change":0.01,"pct_change":0.02,"last_change":"9\/1 12:00am","_id":8,"_parent":4,"_level":3,"_lft":67,"_rgt":76,"_is_leaf":false},16 {"company":"8. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":9,"_parent":2,"_level":3,"_lft":3,"_rgt":6,"_is_leaf":false},17 {"company":"9. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":10,"_parent":7,"_level":3,"_lft":81,"_rgt":82,"_is_leaf":true},18 {"company":"10. E.I. du Pont de Nemours and Company","price":40.48,"change":0.51,"pct_change":1.28,"last_change":"9\/1 12:00am","_id":11,"_parent":3,"_level":3,"_lft":19,"_rgt":36,"_is_leaf":false},19 {"company":"11. Honeywell Intl Inc","price":38.77,"change":0.05,"pct_change":0.13,"last_change":"9\/1 12:00am","_id":12,"_parent":11,"_level":4,"_lft":20,"_rgt":29,"_is_leaf":false},20 {"company":"12. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":13,"_parent":4,"_level":3,"_lft":77,"_rgt":78,"_is_leaf":true},21 {"company":"13. American International Group, Inc.","price":64.13,"change":0.31,"pct_change":0.49,"last_change":"9\/1 12:00am","_id":14,"_parent":null,"_level":1,"_lft":119,"_rgt":122,"_is_leaf":false},22 {"company":"14. Hewlett-Packard Co.","price":36.53,"change":-0.03,"pct_change":-0.08,"last_change":"9\/1 12:00am","_id":15,"_parent":null,"_level":1,"_lft":123,"_rgt":136,"_is_leaf":false},23 {"company":"15. 3m Co","price":71.72,"change":0.02,"pct_change":0.03,"last_change":"9\/1 12:00am","_id":16,"_parent":6,"_level":2,"_lft":102,"_rgt":103,"_is_leaf":true},24 {"company":"16. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":17,"_parent":1,"_level":2,"_lft":86,"_rgt":95,"_is_leaf":false},25 {"company":"17. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":18,"_parent":12,"_level":5,"_lft":21,"_rgt":26,"_is_leaf":false},26 {"company":"18. Verizon Communications","price":35.57,"change":0.39,"pct_change":1.11,"last_change":"9\/1 12:00am","_id":19,"_parent":17,"_level":3,"_lft":87,"_rgt":92,"_is_leaf":false},27 {"company":"19. JP Morgan & Chase & Co","price":45.73,"change":0.07,"pct_change":0.15,"last_change":"9\/1 12:00am","_id":20,"_parent":11,"_level":4,"_lft":30,"_rgt":35,"_is_leaf":false},28 {"company":"20. Merck & Co., Inc.","price":40.96,"change":0.41,"pct_change":1.01,"last_change":"9\/1 12:00am","_id":21,"_parent":3,"_level":3,"_lft":37,"_rgt":46,"_is_leaf":false},29 {"company":"21. Altria Group Inc","price":83.81,"change":0.28,"pct_change":0.34,"last_change":"9\/1 12:00am","_id":22,"_parent":null,"_level":1,"_lft":137,"_rgt":138,"_is_leaf":true},30 {"company":"22. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":23,"_parent":6,"_level":2,"_lft":104,"_rgt":109,"_is_leaf":false},31 {"company":"23. American International Group, Inc.","price":64.13,"change":0.31,"pct_change":0.49,"last_change":"9\/1 12:00am","_id":24,"_parent":15,"_level":2,"_lft":124,"_rgt":133,"_is_leaf":false},32 {"company":"24. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":25,"_parent":23,"_level":3,"_lft":105,"_rgt":108,"_is_leaf":false},33 {"company":"25. American Express Company","price":52.55,"change":0.01,"pct_change":0.02,"last_change":"9\/1 12:00am","_id":26,"_parent":2,"_level":3,"_lft":7,"_rgt":10,"_is_leaf":false},34 {"company":"26. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":27,"_parent":24,"_level":3,"_lft":125,"_rgt":130,"_is_leaf":false},35 {"company":"27. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":28,"_parent":null,"_level":1,"_lft":139,"_rgt":158,"_is_leaf":false},36 {"company":"28. Hewlett-Packard Co.","price":36.53,"change":-0.03,"pct_change":-0.08,"last_change":"9\/1 12:00am","_id":29,"_parent":3,"_level":3,"_lft":47,"_rgt":48,"_is_leaf":true},37 {"company":"29. Altria Group Inc","price":83.81,"change":0.28,"pct_change":0.34,"last_change":"9\/1 12:00am","_id":30,"_parent":21,"_level":4,"_lft":38,"_rgt":41,"_is_leaf":false},38 {"company":"30. The Coca-Cola Company","price":45.07,"change":0.26,"pct_change":0.58,"last_change":"9\/1 12:00am","_id":31,"_parent":null,"_level":1,"_lft":159,"_rgt":160,"_is_leaf":true},39 {"company":"31. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":32,"_parent":3,"_level":3,"_lft":49,"_rgt":52,"_is_leaf":false},40 {"company":"32. United Technologies Corporation","price":63.26,"change":0.55,"pct_change":0.88,"last_change":"9\/1 12:00am","_id":33,"_parent":26,"_level":4,"_lft":8,"_rgt":9,"_is_leaf":true},41 {"company":"33. McDonald's Corporation","price":36.76,"change":0.86,"pct_change":2.4,"last_change":"9\/1 12:00am","_id":34,"_parent":6,"_level":2,"_lft":110,"_rgt":111,"_is_leaf":true},42 {"company":"34. Exxon Mobil Corp","price":68.1,"change":-0.43,"pct_change":-0.64,"last_change":"9\/1 12:00am","_id":35,"_parent":28,"_level":2,"_lft":140,"_rgt":149,"_is_leaf":false},43 {"company":"35. Exxon Mobil Corp","price":68.1,"change":-0.43,"pct_change":-0.64,"last_change":"9\/1 12:00am","_id":36,"_parent":3,"_level":3,"_lft":53,"_rgt":62,"_is_leaf":false},44 {"company":"36. Altria Group Inc","price":83.81,"change":0.28,"pct_change":0.34,"last_change":"9\/1 12:00am","_id":37,"_parent":19,"_level":4,"_lft":88,"_rgt":91,"_is_leaf":false},45 {"company":"37. The Home Depot, Inc.","price":34.64,"change":0.35,"pct_change":1.02,"last_change":"9\/1 12:00am","_id":38,"_parent":36,"_level":4,"_lft":54,"_rgt":59,"_is_leaf":false},46 {"company":"38. Pfizer Inc","price":27.96,"change":0.4,"pct_change":1.45,"last_change":"9\/1 12:00am","_id":39,"_parent":21,"_level":4,"_lft":42,"_rgt":43,"_is_leaf":true},47 {"company":"39. The Coca-Cola Company","price":45.07,"change":0.26,"pct_change":0.58,"last_change":"9\/1 12:00am","_id":40,"_parent":6,"_level":2,"_lft":112,"_rgt":117,"_is_leaf":false},48 {"company":"40. The Procter & Gamble Company","price":61.91,"change":0.01,"pct_change":0.02,"last_change":"9\/1 12:00am","_id":41,"_parent":8,"_level":4,"_lft":68,"_rgt":73,"_is_leaf":false},49 {"company":"41. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":42,"_parent":15,"_level":2,"_lft":134,"_rgt":135,"_is_leaf":true},50 {"company":"42. 3m Co","price":71.72,"change":0.02,"pct_change":0.03,"last_change":"9\/1 12:00am","_id":43,"_parent":24,"_level":3,"_lft":131,"_rgt":132,"_is_leaf":true},51 {"company":"43. Intel Corporation","price":19.88,"change":0.31,"pct_change":1.58,"last_change":"9\/1 12:00am","_id":44,"_parent":7,"_level":3,"_lft":83,"_rgt":84,"_is_leaf":true},52 {"company":"44. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":45,"_parent":38,"_level":5,"_lft":55,"_rgt":58,"_is_leaf":false},53 {"company":"45. Boeing Co.","price":75.43,"change":0.53,"pct_change":0.71,"last_change":"9\/1 12:00am","_id":46,"_parent":45,"_level":6,"_lft":56,"_rgt":57,"_is_leaf":true},54 {"company":"46. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":47,"_parent":30,"_level":5,"_lft":39,"_rgt":40,"_is_leaf":true},55 {"company":"47. Merck & Co., Inc.","price":40.96,"change":0.41,"pct_change":1.01,"last_change":"9\/1 12:00am","_id":48,"_parent":null,"_level":1,"_lft":161,"_rgt":162,"_is_leaf":true},56 {"company":"48. Intel Corporation","price":19.88,"change":0.31,"pct_change":1.58,"last_change":"9\/1 12:00am","_id":49,"_parent":27,"_level":4,"_lft":126,"_rgt":129,"_is_leaf":false},57 {"company":"49. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":50,"_parent":21,"_level":4,"_lft":44,"_rgt":45,"_is_leaf":true},58 {"company":"50. Wal-Mart Stores, Inc.","price":45.45,"change":0.73,"pct_change":1.63,"last_change":"9\/1 12:00am","_id":51,"_parent":2,"_level":3,"_lft":11,"_rgt":16,"_is_leaf":false},59 {"company":"51. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":52,"_parent":3,"_level":3,"_lft":63,"_rgt":64,"_is_leaf":true},60 {"company":"52. Boeing Co.","price":75.43,"change":0.53,"pct_change":0.71,"last_change":"9\/1 12:00am","_id":53,"_parent":null,"_level":1,"_lft":163,"_rgt":164,"_is_leaf":true},61 {"company":"53. 3m Co","price":71.72,"change":0.02,"pct_change":0.03,"last_change":"9\/1 12:00am","_id":54,"_parent":25,"_level":4,"_lft":106,"_rgt":107,"_is_leaf":true},62 {"company":"54. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":55,"_parent":null,"_level":1,"_lft":165,"_rgt":170,"_is_leaf":false},63 {"company":"55. E.I. du Pont de Nemours and Company","price":40.48,"change":0.51,"pct_change":1.28,"last_change":"9\/1 12:00am","_id":56,"_parent":35,"_level":3,"_lft":141,"_rgt":144,"_is_leaf":false},64 {"company":"56. Intel Corporation","price":19.88,"change":0.31,"pct_change":1.58,"last_change":"9\/1 12:00am","_id":57,"_parent":32,"_level":4,"_lft":50,"_rgt":51,"_is_leaf":true},65 {"company":"57. American International Group, Inc.","price":64.13,"change":0.31,"pct_change":0.49,"last_change":"9\/1 12:00am","_id":58,"_parent":35,"_level":3,"_lft":145,"_rgt":146,"_is_leaf":true},66 {"company":"58. Exxon Mobil Corp","price":68.1,"change":-0.43,"pct_change":-0.64,"last_change":"9\/1 12:00am","_id":59,"_parent":18,"_level":6,"_lft":22,"_rgt":23,"_is_leaf":true},67 {"company":"59. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":60,"_parent":null,"_level":1,"_lft":171,"_rgt":172,"_is_leaf":true},68 {"company":"60. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":61,"_parent":null,"_level":1,"_lft":173,"_rgt":174,"_is_leaf":true},69 {"company":"61. McDonald's Corporation","price":36.76,"change":0.86,"pct_change":2.4,"last_change":"9\/1 12:00am","_id":62,"_parent":41,"_level":5,"_lft":69,"_rgt":72,"_is_leaf":false},70 {"company":"62. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":63,"_parent":51,"_level":4,"_lft":12,"_rgt":15,"_is_leaf":false},71 {"company":"63. Johnson & Johnson","price":64.72,"change":0.06,"pct_change":0.09,"last_change":"9\/1 12:00am","_id":64,"_parent":17,"_level":3,"_lft":93,"_rgt":94,"_is_leaf":true},72 {"company":"64. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":65,"_parent":36,"_level":4,"_lft":60,"_rgt":61,"_is_leaf":true},73 {"company":"65. Verizon Communications","price":35.57,"change":0.39,"pct_change":1.11,"last_change":"9\/1 12:00am","_id":66,"_parent":63,"_level":5,"_lft":13,"_rgt":14,"_is_leaf":true},74 {"company":"66. General Motors Corporation","price":30.27,"change":1.09,"pct_change":3.74,"last_change":"9\/1 12:00am","_id":67,"_parent":null,"_level":1,"_lft":175,"_rgt":176,"_is_leaf":true},75 {"company":"67. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":68,"_parent":37,"_level":5,"_lft":89,"_rgt":90,"_is_leaf":true},76 {"company":"68. Wal-Mart Stores, Inc.","price":45.45,"change":0.73,"pct_change":1.63,"last_change":"9\/1 12:00am","_id":69,"_parent":28,"_level":2,"_lft":150,"_rgt":157,"_is_leaf":false},77 {"company":"69. The Home Depot, Inc.","price":34.64,"change":0.35,"pct_change":1.02,"last_change":"9\/1 12:00am","_id":70,"_parent":null,"_level":1,"_lft":177,"_rgt":182,"_is_leaf":false},78 {"company":"70. E.I. du Pont de Nemours and Company","price":40.48,"change":0.51,"pct_change":1.28,"last_change":"9\/1 12:00am","_id":71,"_parent":55,"_level":2,"_lft":166,"_rgt":169,"_is_leaf":false},79 {"company":"71. General Electric Company","price":34.14,"change":-0.08,"pct_change":-0.23,"last_change":"9\/1 12:00am","_id":72,"_parent":49,"_level":5,"_lft":127,"_rgt":128,"_is_leaf":true},80 {"company":"72. Exxon Mobil Corp","price":68.1,"change":-0.43,"pct_change":-0.64,"last_change":"9\/1 12:00am","_id":73,"_parent":14,"_level":2,"_lft":120,"_rgt":121,"_is_leaf":true},81 {"company":"73. Citigroup, Inc.","price":49.37,"change":0.02,"pct_change":0.04,"last_change":"9\/1 12:00am","_id":74,"_parent":null,"_level":1,"_lft":183,"_rgt":184,"_is_leaf":true},82 {"company":"74. Wal-Mart Stores, Inc.","price":45.45,"change":0.73,"pct_change":1.63,"last_change":"9\/1 12:00am","_id":75,"_parent":40,"_level":3,"_lft":113,"_rgt":116,"_is_leaf":false},83 {"company":"75. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":76,"_parent":9,"_level":4,"_lft":4,"_rgt":5,"_is_leaf":true},84 {"company":"76. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":77,"_parent":35,"_level":3,"_lft":147,"_rgt":148,"_is_leaf":true},85 {"company":"77. E.I. du Pont de Nemours and Company","price":40.48,"change":0.51,"pct_change":1.28,"last_change":"9\/1 12:00am","_id":78,"_parent":56,"_level":4,"_lft":142,"_rgt":143,"_is_leaf":true},86 {"company":"78. E.I. du Pont de Nemours and Company","price":40.48,"change":0.51,"pct_change":1.28,"last_change":"9\/1 12:00am","_id":79,"_parent":69,"_level":3,"_lft":151,"_rgt":156,"_is_leaf":false},87 {"company":"79. General Motors Corporation","price":30.27,"change":1.09,"pct_change":3.74,"last_change":"9\/1 12:00am","_id":80,"_parent":70,"_level":2,"_lft":178,"_rgt":181,"_is_leaf":false},88 {"company":"80. 3m Co","price":71.72,"change":0.02,"pct_change":0.03,"last_change":"9\/1 12:00am","_id":81,"_parent":null,"_level":1,"_lft":185,"_rgt":186,"_is_leaf":true},89 {"company":"81. The Coca-Cola Company","price":45.07,"change":0.26,"pct_change":0.58,"last_change":"9\/1 12:00am","_id":82,"_parent":null,"_level":1,"_lft":187,"_rgt":190,"_is_leaf":false},90 {"company":"82. Honeywell Intl Inc","price":38.77,"change":0.05,"pct_change":0.13,"last_change":"9\/1 12:00am","_id":83,"_parent":null,"_level":1,"_lft":191,"_rgt":192,"_is_leaf":true},91 {"company":"83. American Express Company","price":52.55,"change":0.01,"pct_change":0.02,"last_change":"9\/1 12:00am","_id":84,"_parent":12,"_level":5,"_lft":27,"_rgt":28,"_is_leaf":true},92 {"company":"84. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":85,"_parent":null,"_level":1,"_lft":193,"_rgt":194,"_is_leaf":true},93 {"company":"85. Microsoft Corporation","price":25.84,"change":0.14,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":86,"_parent":71,"_level":3,"_lft":167,"_rgt":168,"_is_leaf":true},94 {"company":"86. Pfizer Inc","price":27.96,"change":0.4,"pct_change":1.45,"last_change":"9\/1 12:00am","_id":87,"_parent":null,"_level":1,"_lft":195,"_rgt":196,"_is_leaf":true},95 {"company":"87. The Home Depot, Inc.","price":34.64,"change":0.35,"pct_change":1.02,"last_change":"9\/1 12:00am","_id":88,"_parent":75,"_level":4,"_lft":114,"_rgt":115,"_is_leaf":true},96 {"company":"88. General Electric Company","price":34.14,"change":-0.08,"pct_change":-0.23,"last_change":"9\/1 12:00am","_id":89,"_parent":null,"_level":1,"_lft":197,"_rgt":198,"_is_leaf":true},97 {"company":"89. Caterpillar Inc.","price":67.27,"change":0.92,"pct_change":1.39,"last_change":"9\/1 12:00am","_id":90,"_parent":8,"_level":4,"_lft":74,"_rgt":75,"_is_leaf":true},98 {"company":"90. The Procter & Gamble Company","price":61.91,"change":0.01,"pct_change":0.02,"last_change":"9\/1 12:00am","_id":91,"_parent":82,"_level":2,"_lft":188,"_rgt":189,"_is_leaf":true},99 {"company":"91. The Home Depot, Inc.","price":34.64,"change":0.35,"pct_change":1.02,"last_change":"9\/1 12:00am","_id":92,"_parent":18,"_level":6,"_lft":24,"_rgt":25,"_is_leaf":true},100 {"company":"92. International Business Machines","price":81.41,"change":0.44,"pct_change":0.54,"last_change":"9\/1 12:00am","_id":93,"_parent":1,"_level":2,"_lft":96,"_rgt":97,"_is_leaf":true},101 {"company":"93. AT&T Inc.","price":31.61,"change":-0.48,"pct_change":-1.54,"last_change":"9\/1 12:00am","_id":94,"_parent":79,"_level":4,"_lft":152,"_rgt":155,"_is_leaf":false},102 {"company":"94. Intel Corporation","price":19.88,"change":0.31,"pct_change":1.58,"last_change":"9\/1 12:00am","_id":95,"_parent":20,"_level":5,"_lft":31,"_rgt":34,"_is_leaf":false},103 {"company":"95. Alcoa Inc","price":29.01,"change":0.42,"pct_change":1.47,"last_change":"9\/1 12:00am","_id":96,"_parent":62,"_level":6,"_lft":70,"_rgt":71,"_is_leaf":true},104 {"company":"96. The Home Depot, Inc.","price":34.64,"change":0.35,"pct_change":1.02,"last_change":"9\/1 12:00am","_id":97,"_parent":null,"_level":1,"_lft":199,"_rgt":200,"_is_leaf":true},105 {"company":"97. McDonald's Corporation","price":36.76,"change":0.86,"pct_change":2.4,"last_change":"9\/1 12:00am","_id":98,"_parent":95,"_level":6,"_lft":32,"_rgt":33,"_is_leaf":true},106 {"company":"98. General Electric Company","price":34.14,"change":-0.08,"pct_change":-0.23,"last_change":"9\/1 12:00am","_id":99,"_parent":94,"_level":5,"_lft":153,"_rgt":154,"_is_leaf":true},107 {"company":"99. Boeing Co.","price":75.43,"change":0.53,"pct_change":0.71,"last_change":"9\/1 12:00am","_id":100,"_parent":80,"_level":3,"_lft":179,"_rgt":180,"_is_leaf":true}108 ];109 110 // add in some dummy descriptions and loaded flag111 for (var i = 0; i < data.length; i++) {112 data[i].desc = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Sed metus nibh, sodales a, porta at, vulputate eget, dui. Pellentesque ut nisl. Maecenas tortor turpis, interdum non, sodales non, iaculis ac, lacus. Vestibulum auctor, tortor quis iaculis malesuada, libero lectus bibendum purus, sit amet tincidunt quam turpis vel lacus. In pellentesque nisl non sem. Suspendisse nunc sem, pretium eget, cursus a, fringilla vel, urna.<br/><br/>Aliquam commodo ullamcorper erat. Nullam vel justo in neque porttitor laoreet. Aenean lacus dui, consequat eu, adipiscing eget, nonummy non, nisi. Morbi nunc est, dignissim non, ornare sed, luctus eu, massa. Vivamus eget quam. Vivamus tincidunt diam nec urna. Curabitur velit.';113 data[i]._is_loaded = true;114 }115116 // create the data store117 var record = Ext.data.Record.create([118 {name: 'company'},119 {name: 'price', type: 'float'},120 {name: 'change', type: 'float'},121 {name: 'pct_change', type: 'float'},122 {name: 'last_change', type: 'date', dateFormat: 'n/j h:ia'},123 {name: 'desc'},124 {name: '_id', type: 'int'},125 {name: '_level', type: 'int'},126 {name: '_lft', type: 'int'},127 {name: '_rgt', type: 'int'},128 {name: '_is_leaf', type: 'bool'}129 ]);130 var store = new Ext.ux.maximgb.tg.NestedSetStore({131 autoLoad : true,132 reader: new Ext.data.JsonReader({id: '_id'}, record),133 proxy: new Ext.data.MemoryProxy(data)134 });135 // create the Grid136 var grid = new Ext.ux.maximgb.tg.EditorGridPanel({137 store: store,138 master_column_id : 'company',139 columns: [{140 id:'company',141 header: "Company", 142 width: 160, 143 sortable: true, 144 dataIndex: 'company', 145 editor: new Ext.form.TextField() 146 }, {147 header: "Price", 148 width: 75, 149 sortable: true, 150 renderer: 'usMoney', 151 dataIndex: 'price',152 editor: new Ext.form.NumberField({153 allowDecimals: true, 154 allowNegative: false155 })156 }, {157 header: "Change", 158 width: 75, 159 sortable: true, 160 renderer: change, 161 dataIndex: 'change',162 editor: new Ext.form.NumberField({163 allowDecimals: true, 164 allowNegative: true165 })166 }, {167 header: "% Change", 168 width: 75, 169 sortable: true, 170 renderer: pctChange, 171 dataIndex: 'pct_change',172 editor: new Ext.form.NumberField({173 allowDecimals: true, 174 allowNegative: true175 })176 }, {177 header: "Last Updated", 178 width: 85, 179 sortable: true, 180 renderer: Ext.util.Format.dateRenderer('m/d/Y'), 181 dataIndex: 'last_change',182 editor: new Ext.form.DateField()183 }184 ],185 stripeRows: true,186 autoExpandColumn: 'company',187 title: 'Array Grid',188 viewConfig : {189 enableRowBody : true190 }191 });192 var vp = new Ext.Viewport({193 layout : 'fit',194 items : grid195 });196 }197 198 // example of custom renderer function199 function change(val)200 {201 if (val > 0) {202 val = '<span style="color:green;">' + val + '</span>';203 } 204 else if(val < 0) {205 val = '<span style="color:red;">' + val + '</span>';206 }207 return val;208 }209210 // example of custom renderer function211 function pctChange(val)212 {213 if (val > 0) {214 val = '<span style="color:green;">' + val + '%</span>';215 } 216 else if(val < 0) {217 val = '<span style="color:red;">' + val + '%</span>';218 }219 return val;220 }221222 return {223 init : function()224 {225 createGrid();226 }227 }228}();229
...
Navi.js
Source:Navi.js
1var lftNav='';2lftNav+=' <div class="sidebar-collapse">'; 3lftNav+=' <ul class="nav" id="main-menu">'; 4lftNav+=' <li>'; 5lftNav+=' <div class="user-img-div">'; 6lftNav+=' <div class="inner-text">'; 7lftNav+=' Sam'; 8lftNav+=' <br />'; 9lftNav+=' <small>Last Login : 10 hourse Ago </small>'; 10lftNav+=' <br />'; 11lftNav+=' <small>Role : Admin </small>'; 12lftNav+=' </div>'; 13lftNav+=' </div>'; 14lftNav+=' </li>'; 15lftNav+=' <li>'; 16lftNav+=' <a id="dash_board" href="./remsIndex"><i class="fa fa-dashboard "></i>Dashboard</a>'; 17lftNav+=' </li>'; 18lftNav+=' <li>'; 19lftNav+=' <a id="apps" href="#"><i class="fa fa-yelp "></i>Applications <span class="fa arrow"></span></a>'; 20lftNav+=' <ul id="coll_in_apps" class="nav nav-second-level">'; 21lftNav+=' <li>'; 22lftNav+=' <a id="view_app" href="./remsAppView"><i class="fa fa-list"></i>View Application</a>'; 23lftNav+=' </li>'; 24lftNav+=' <li>'; 25lftNav+=' <a id="add_app" href="./remsAppAdd"><i class="fa fa-plus "></i>Add Application</a>'; 26lftNav+=' </li>'; 27lftNav+=' </ul>'; 28lftNav+=' </li>';29lftNav+=' <li>'; 30lftNav+=' <a id="user" href="#"><i class="fa fa-users "></i>Users <span class="fa arrow"></span></a>'; 31lftNav+=' <ul id="coll_in_user" class="nav nav-second-level">'; 32lftNav+=' <li>'; 33lftNav+=' <a id="view_user" href="./remsViewUsers"><i class="fa fa-user"></i>View User</a>'; 34lftNav+=' </li>'; 35lftNav+=' <li>'; 36lftNav+=' <a id="add_user" href="./remsCreateUser"><i class="fa fa-plus"></i>Add User</a>'; 37lftNav+=' </li>'; 38lftNav+=' </ul>'; 39lftNav+=' </li>';40lftNav+=' <li>'; 41lftNav+=' <a id="env" href="#"><i class="fa fa-sitemap "></i>Environments <span class="fa arrow"></span></a>'; 42lftNav+=' <ul id="coll_in_env" class="nav nav-second-level">'; 43lftNav+=' <li>'; 44lftNav+=' <a id="view_env" href="./remsViewEnv"><i class="fa fa-list"></i>View Environment</a>'; 45lftNav+=' </li>'; 46lftNav+=' <li>'; 47lftNav+=' <a id="add_env" href="./remsCreateEnv"><i class="fa fa-plus "></i>Add Environment</a>'; 48lftNav+=' </li>'; 49lftNav+=' <li>'; 50lftNav+=' <a id="env_avail" href="./remsEvnAvailability"><i class="fa fa-list "></i>Availability</a>'; 51lftNav+=' </li>'; 52lftNav+=' </ul>'; 53lftNav+=' <li>'; 54lftNav+=' <a id="book" href="#"><i class="fa fa-book"></i>Bookings <span class="fa arrow"></span></a>'; 55lftNav+=' <ul id="coll_in_book" class="nav nav-second-level">'; 56lftNav+=' <li>'; 57lftNav+=' <a id="search_book" href="./remsSearchBookEnv"><i class="fa fa-search"></i>Search & Book</a>'; 58lftNav+=' </li>'; 59lftNav+=' <li>'; 60lftNav+=' <a id="booking" href="./remsEvnBooking"><i class="fa fa-search-plus "></i>Booking</a>'; 61lftNav+=' </li>'; 62lftNav+=' <li>'; 63lftNav+=' <a id="rej_appr_book" href="./remsBookingDecision"><i class="fa fa-ticket"></i>Approve/Reject Bookings</a>'; 64lftNav+=' </li>'; 65lftNav+=' </ul>'; 66lftNav+=' </li>';67lftNav+=' </li>';68lftNav+=' </ul>'; 69lftNav+=' </div>'; ...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3}, function(err, data) {4 if (err) {5 return console.error(err);6 }7 console.log('Test Results for: ' + data.data.summary);8});9var wpt = require('webpagetest');10var wpt = new WebPageTest('www.webpagetest.org');11}, function(err, data) {12 if (err) {13 return console.error(err);14 }15 console.log('Test Results for: ' + data.data.summary);16});17var wpt = require('webpagetest');18var wpt = new WebPageTest('www.webpagetest.org');19}, function(err, data) {20 if (err) {21 return console.error(err);22 }23 console.log('Test Results for: ' + data.data.summary);24});25var wpt = require('webpagetest');26var wpt = new WebPageTest('www.webpagetest.org');27}, function(err, data) {28 if (err) {29 return console.error(err);30 }31 console.log('Test Results for: ' + data.data.summary);32});33var wpt = require('webpagetest');34var wpt = new WebPageTest('www.webpagetest.org');35}, function(err, data) {36 if (err) {37 return console.error(err);38 }39 console.log('Test Results for: ' + data.data.summary);40});
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3var options = { location: 'Dulles:Chrome', connectivity: 'Cable' };4wpt.runTest(url, options, function(err, data) {5 if (err) return console.log(err);6 console.log('Test Results: ' + data.data.userUrl);7 wpt.getTestResults(data.data.testId, function(err, data) {8 if (err) return console.log(err);9 console.log('Speed Index: ' + data.data.average.firstView.SpeedIndex);10 });11});12### WebPageTest(options)13### .runTest(url, [options], callback)
Using AI Code Generation
1var wpt = require("wpt");2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log(data);5});6var wpt = require("wpt");7var wpt = new WebPageTest('www.webpagetest.org');8 if (err) return console.error(err);9 console.log(data);10});11var wpt = require("wpt");12var wpt = new WebPageTest('www.webpagetest.org');13 if (err) return console.error(err);14 console.log(data);15});16var wpt = require("wpt");17var wpt = new WebPageTest('www.webpagetest.org');18 if (err) return console.error(err);19 console.log(data);20});
Using AI Code Generation
1var lft = require('lft');2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8var lft = require('lft');9 if (err) {10 console.log(err);11 } else {12 console.log(data);13 }14});15MIT © [Ali Akhtarzada](
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var runTest = function (url) {5 var wpt = new WebPageTest('www.webpagetest.org', 'A.8a0e5f2d1f5b2a4f0f8b8c2c9d1f2b1d');6 wpt.runTest(url, {7 }, function (err, data) {8 console.log(data);9 });10};11var getTestResults = function (testId) {12 var wpt = new WebPageTest('www.webpagetest.org', 'A.8a0e5f2d1f5b2a4f0f8b8c2c9d1f2b1d');13 wpt.getTestResults(testId, function (err, data) {14 console.log(data);15 });16};17var getTestStatus = function (testId) {18 var wpt = new WebPageTest('www.webpagetest.org', 'A.8a0e5f2d1f5b2a4f0f8b8c2c9d1f2b1d');19 wpt.getTestStatus(testId, function (err, data) {20 console.log(data);21 });22};23var getLocations = function () {24 var wpt = new WebPageTest('www.webpagetest.org', 'A.8a0e5f2d1f5b2a4f0f8b8c2c9d1f2b1d');25 wpt.getLocations(function (err, data) {26 console.log(data);27 });28};29var getBrowsers = function () {30 var wpt = new WebPageTest('www.webpagetest.org', 'A.8a0e5f2d1f5b2a4f0f8b8c2c9d1f2b1d');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!