[fix] [bug] grid-reorder

This commit is contained in:
Rushabh Mehta 2016-06-01 07:01:29 +05:30
parent b33ab3ac75
commit d613820f82
2 changed files with 8 additions and 1 deletions

View file

@ -107,7 +107,6 @@ frappe.ModuleEditor = Class.extend({
make: function() {
var me = this;
this.frm.doc.__onload.all_modules.forEach(function(m) {
// TODO: add checkbox
$(repl('<div class="col-sm-6"><div class="checkbox">\
<label><input type="checkbox" class="block-module-check" data-module="%(module)s">\
%(module)s</label></div></div>', {module: m})).appendTo(me.wrapper);

View file

@ -214,6 +214,13 @@ frappe.ui.form.Grid = Class.extend({
$(this).find(".row-index").html(i + 1);
me.frm.doc[me.df.fieldname].push(doc);
});
// re-order grid-rows by name
me.grid_rows = [];
me.frm.doc[me.df.fieldname].forEach(function(d) {
me.grid_rows.push(me.grid_rows_by_docname[d.name]);
});
me.frm.dirty();
}
});
@ -583,6 +590,7 @@ frappe.ui.form.GridRow = Class.extend({
this.row_index.html(this.doc ? this.doc.idx : "&nbsp;");
}
// TODO: remove grid templates
if(this.grid.template && false) {
// rendered via template
this.row_data && this.row_data.empty();