244 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
244 return datarecord.supplier+ " / " + datarecord.name + " (" + datarecord.color + " EBC)"; |
245 } |
245 } |
246 }); |
246 }); |
247 $("#faddrowbutton").on('select', function (event) { |
247 $("#faddrowbutton").on('select', function (event) { |
248 if (event.args) { |
248 if (event.args) { |
|
249 var rowscount = $("#fermentableGrid").jqxGrid('getdatainformation').rowscount; |
249 var index = event.args.index; |
250 var index = event.args.index; |
250 var datarecord = fermentablelist.records[index]; |
251 var datarecord = fermentablelist.records[index]; |
251 var row = {}; |
252 var row = {}; |
252 row["f_name"] = datarecord.name; |
253 row["f_name"] = datarecord.name; |
253 row["f_origin"] = datarecord.origin; |
254 row["f_origin"] = datarecord.origin; |
269 row["f_added"] = "Mash"; |
270 row["f_added"] = "Mash"; |
270 } |
271 } |
271 row["f_dissolved_protein"] = 0; |
272 row["f_dissolved_protein"] = 0; |
272 row["f_recommend_mash"] = datarecord.recommend_mash; |
273 row["f_recommend_mash"] = datarecord.recommend_mash; |
273 row["f_add_after_boil"] = datarecord.add_after_boil; |
274 row["f_add_after_boil"] = datarecord.add_after_boil; |
274 row["f_adjust_to_total_100"] = 0; |
275 if (rowscount == 0) { |
275 row["f_percentage"] = 0; |
276 // The first fermentable |
|
277 row["f_adjust_to_total_100"] = 1; |
|
278 row["f_percentage"] = 100; |
|
279 } else { |
|
280 row["f_adjust_to_total_100"] = 0; |
|
281 row["f_percentage"] = 0; |
|
282 } |
276 row["f_di_ph"] = datarecord.di_ph; |
283 row["f_di_ph"] = datarecord.di_ph; |
277 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); |
284 var commit = $("#fermentableGrid").jqxGrid('addrow', null, row); |
278 } |
285 } |
279 }); |
286 }); |
280 |
287 |