From 9cb2cdbce6635d034eb09e05d8c09d2fcb7a88e4 Mon Sep 17 00:00:00 2001
From: Akhilesh Darjee <akhileshdarjee@gmail.com>
Date: Mon, 30 Sep 2013 15:43:00 +0530
Subject: [PATCH] [price_list] [minor] fix of new grid

---
 setup/doctype/price_list/price_list.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/setup/doctype/price_list/price_list.js b/setup/doctype/price_list/price_list.js
index a190710d4e..cbca413f0c 100644
--- a/setup/doctype/price_list/price_list.js
+++ b/setup/doctype/price_list/price_list.js
@@ -181,7 +181,7 @@ wn.ui.form.TableGrid = Class.extend({
 		var dialog_values = {};
 
 		$.each(this.fields, function(i, item) {
-			dialog_values[item.fieldname] = $(row).find('td[data-fieldname="'+ item.fieldname +'"]').data('fieldvalue');
+			dialog_values[item.fieldname] = $(row).find('td[data-fieldname="'+ item.fieldname +'"]').attr('data-fieldvalue');
 		});
 
 		return dialog_values;
@@ -206,9 +206,9 @@ wn.ui.form.TableGrid = Class.extend({
 			$.each(me.fields, function(i, item) {
 				var $td = $(row).find('td[data-fieldname="'+ item.fieldname +'"]');
 				var val = me.dialog.get_values()[item.fieldname];
-				
+
 				wn.model.set_value(me.table_field.options, $td.attr('data-doc_name'), 
-					item.fieldname, me.dialog.get_values()[item.fieldname]);
+					item.fieldname, val);
 				$td.attr('data-fieldvalue', val);
 				
 				// If field type is currency the update with format currency
@@ -279,6 +279,10 @@ wn.ui.form.TableGrid = Class.extend({
 			}
 		});
 
+		// refresh field to push to grid rows
+		refresh_field(this.table_field.fieldname);
+
+		// append row to tbody of grid
 		$(new_row).appendTo($(this.parent).find(".grid tbody"));
 	}
 });
\ No newline at end of file