New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Web form child table new rows save #203
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -193,6 +193,10 @@ export default class Grid { | |||||
} | ||||||
} | ||||||
refresh(force) { | ||||||
if (!this.df.data){this.df.data = [];} | ||||||
|
||||||
this.data = this.get_data(); | ||||||
|
||||||
!this.wrapper && this.make(); | ||||||
var me = this, | ||||||
$rows = $(me.parent).find(".rows"), | ||||||
|
@@ -365,6 +369,7 @@ export default class Grid { | |||||
$(this.frm.wrapper).trigger("grid-make-sortable", [this.frm]); | ||||||
} | ||||||
get_data() { | ||||||
// this.remove_all(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove comment |
||||||
var data = this.frm ? | ||||||
this.frm.doc[this.df.fieldname] || [] | ||||||
: this.df.data || this.get_modal_data(); | ||||||
|
@@ -489,7 +494,12 @@ export default class Grid { | |||||
if (!this.df.data) { | ||||||
this.df.data = this.get_data() || []; | ||||||
} | ||||||
this.df.data.push({idx: this.df.data.length+1, __islocal: true}); | ||||||
var d = { idx: this.df.data.length + 1, __islocal: true, doctype: this.doctype, parentfield: this.df.fieldname, parenttype: frappe.web_form.doctype } | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
this.df.data.push(d); | ||||||
if(!frappe.web_form.doc.hasOwnProperty(this.df.fieldname)) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's just use the
Suggested change
|
||||||
frappe.web_form.doc[this.df.fieldname] = []; | ||||||
} | ||||||
frappe.web_form.doc[this.df.fieldname].push(d); | ||||||
this.refresh(); | ||||||
} | ||||||
|
||||||
|
@@ -506,7 +516,6 @@ export default class Grid { | |||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
return d; | ||||||
} | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.