[fix] [minor] new grid to hide delete button on new row & added description

This commit is contained in:
Akhilesh Darjee 2013-09-30 15:56:36 +05:30
parent 9cb2cdbce6
commit eb8753e8b6
2 changed files with 5 additions and 4 deletions

View File

@ -164,7 +164,7 @@ wn.ui.form.TableGrid = Class.extend({
if (row) if (row)
this.dialog.set_values(this.make_dialog_values(row)); this.dialog.set_values(this.make_dialog_values(row));
$a(this.dialog.body, 'div', '', '', this.make_dialog_buttons()); $a(this.dialog.body, 'div', '', '', this.make_dialog_buttons(row));
this.dialog.show(); this.dialog.show();
this.dialog.$wrapper.find('button.update').on('click', function() { this.dialog.$wrapper.find('button.update').on('click', function() {
@ -186,12 +186,12 @@ wn.ui.form.TableGrid = Class.extend({
return dialog_values; return dialog_values;
}, },
make_dialog_buttons: function() { make_dialog_buttons: function(row) {
var me = this; var me = this;
var buttons = '<button class="btn btn-primary update">Update</button>'; var buttons = '<button class="btn btn-primary update">Update</button>';
// if user can delete then only add the delete button in dialog // if user can delete then only add the delete button in dialog
if (wn.model.can_delete(me.frm.doc.doctype)) if (wn.model.can_delete(me.frm.doc.doctype) && row)
buttons += ' <button class="btn btn-default delete">Delete</button>'; buttons += ' <button class="btn btn-default delete">Delete</button>';
return buttons; return buttons;

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-25 11:35:09", "creation": "2013-01-25 11:35:09",
"docstatus": 0, "docstatus": 0,
"modified": "2013-09-06 15:03:38", "modified": "2013-09-30 15:50:52",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -85,6 +85,7 @@
"reqd": 1 "reqd": 1
}, },
{ {
"description": "To change row values, click on the respective row",
"doctype": "DocField", "doctype": "DocField",
"fieldname": "item_prices_section", "fieldname": "item_prices_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",