Commit b29932eb authored by Dmitry Volodin's avatar Dmitry Volodin
Browse files

Merge branch 'noc-693' into 'microservices'

#693

See merge request !1173
parents 7856e9db 7ea7a487
Pipeline #8168 passed with stages
in 5 minutes and 58 seconds
......@@ -613,6 +613,18 @@ Ext.define("NOC.core.ModelApplication", {
rowEditing.startEdit(0, 0);
}
},
{
text: __("Append"),
glyph: NOC.glyph.sign_in,
handler: function() {
var grid = this.up("panel"),
position = grid.store.data.length,
rowEditing = grid.plugins[0];
rowEditing.cancelEdit();
grid.store.insert(position, {});
rowEditing.startEdit(position, 0);
}
},
{
text: __("Delete"),
glyph: NOC.glyph.times,
......
......@@ -43,6 +43,13 @@ Ext.define("Ext.ux.form.GridField", {
handler: me.onAddRecord
});
me.appendButton = Ext.create("Ext.button.Button", {
text: __("Append"),
glyph: NOC.glyph.sign_in,
scope: me,
handler: Ext.pass(me.onAddRecord, true)
});
me.deleteButton = Ext.create("Ext.button.Button", {
text: __("Delete"),
glyph: NOC.glyph.minus,
......@@ -62,6 +69,7 @@ Ext.define("Ext.ux.form.GridField", {
// Build toolbar
toolbar = [
me.addButton,
me.appendButton,
me.deleteButton,
"-",
me.cloneButton
......@@ -143,12 +151,16 @@ Ext.define("Ext.ux.form.GridField", {
me.cloneButton.setDisabled(false);
},
//
onAddRecord: function() {
onAddRecord: function(self, evt, toEnd) {
var me = this,
rowEditing = me.grid.plugins[0];
rowEditing = me.grid.plugins[0],
position = 0;
if(toEnd) {
position = me.grid.store.data.length;
}
rowEditing.cancelEdit();
me.grid.store.insert(0, {});
rowEditing.startEdit(0, 0);
me.grid.store.insert(position, {});
rowEditing.startEdit(position, 0);
},
//
onDeleteRecord: function() {
......
......@@ -28,6 +28,13 @@ Ext.define("Ext.ux.form.StringsField", {
handler: me.onAddRecord
});
me.appendButton = Ext.create("Ext.button.Button", {
text: __("Append"),
glyph: NOC.glyph.sign_in,
scope: me,
handler: Ext.pass(me.onAddRecord, true)
});
me.deleteButton = Ext.create("Ext.button.Button", {
text: __("Delete"),
glyph: NOC.glyph.minus,
......@@ -63,6 +70,7 @@ Ext.define("Ext.ux.form.StringsField", {
dock: "top",
items: [
me.addButton,
me.appendButton,
me.deleteButton
]
}
......@@ -115,12 +123,16 @@ Ext.define("Ext.ux.form.StringsField", {
me.deleteButton.setDisabled(false);
},
//
onAddRecord: function() {
onAddRecord: function(self, evt, toEnd) {
var me = this,
rowEditing = me.grid.plugins[0];
rowEditing = me.grid.plugins[0],
position = 0;
if(toEnd) {
position = me.grid.store.data.length;
}
rowEditing.cancelEdit();
me.grid.store.insert(0, {value: ""});
rowEditing.startEdit(0, 0);
me.grid.store.insert(position, {value: ""});
rowEditing.startEdit(position, 0);
me.fireEvent("dirtychange", me);
},
//
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment