fix: no need to set random fieldname while adding column

This commit is contained in:
Shariq Ansari 2022-11-10 23:58:34 +05:30
parent 258d62f096
commit 8710d64c86
2 changed files with 7 additions and 8 deletions

View file

@ -14,8 +14,8 @@ function add_column() {
// insert new column after the current column
let index = props.section.columns.indexOf(props.column);
props.section.columns.splice(index + 1, 0, {
df: store.get_df("Column Break", "column_break_" + frappe.utils.get_random(4)),
fields: []
df: store.get_df("Column Break"),
fields: [],
});
}
@ -36,9 +36,9 @@ function remove_column() {
if (props.column.fields.length != 0) {
// create a new column if current column has fields and push fields to it
columns.unshift({
df: store.get_df("Column Break", "column_break_" + frappe.utils.get_random(4)),
df: store.get_df("Column Break"),
fields: props.column.fields,
is_first: true
is_first: true,
});
index++;
} else {

View file

@ -51,8 +51,7 @@ export function create_layout(fields) {
function get_new_column(df) {
let _column = {};
_column.df =
df || store.get_df("Column Break", "column_break_" + frappe.utils.get_random(4));
_column.df = df || store.get_df("Column Break");
_column.fields = [];
_column.is_first = !df;
return _column;
@ -169,11 +168,11 @@ export function section_boilerplate() {
df: store.get_df("Section Break"),
columns: [
{
df: store.get_df("Column Break", "column_break_" + frappe.utils.get_random(4)),
df: store.get_df("Column Break"),
fields: [],
},
{
df: store.get_df("Column Break", "column_break_" + frappe.utils.get_random(4)),
df: store.get_df("Column Break"),
fields: [],
},
],