Repository: incubator-nifi
Updated Branches:
  refs/heads/develop 3a2b12d7c -> 7369730ce


NIFI-481:
- Enabling enter to add a new property.
- Autoselecting and scrolling to new property rows.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/6bbd1723
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/6bbd1723
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/6bbd1723

Branch: refs/heads/develop
Commit: 6bbd172399f9a9966c666bb51ea3ff09affbcd11
Parents: 2c35226
Author: Matt Gilman <[email protected]>
Authored: Thu Apr 2 22:34:34 2015 -0400
Committer: Matt Gilman <[email protected]>
Committed: Thu Apr 2 22:34:34 2015 -0400

----------------------------------------------------------------------
 .../js/jquery/propertytable/jquery.propertytable.js | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/6bbd1723/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
----------------------------------------------------------------------
diff --git 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
index 31495bb..bbafc60 100644
--- 
a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
+++ 
b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/jquery/propertytable/jquery.propertytable.js
@@ -1159,8 +1159,9 @@
                                 // add a row for the new property
                                 var propertyGrid = table.data('gridInstance');
                                 var propertyData = propertyGrid.getData();
+                                var id = propertyData.getLength(); 
                                 propertyData.addItem({
-                                    id: propertyData.getLength(),
+                                    id: id,
                                     hidden: false,
                                     property: propertyName,
                                     displayName: propertyName,
@@ -1168,6 +1169,11 @@
                                     value: null,
                                     type: 'userDefined'
                                 });
+                                
+                                // select the new properties row
+                                var row = propertyData.getRowById(id);
+                                propertyGrid.setSelectedRows([row]);
+                                propertyGrid.scrollRowIntoView(row);
                             } else {
                                 nf.Dialog.showOkDialog({
                                     dialogContent: 'Property name must be 
specified.',
@@ -1182,6 +1188,14 @@
                         var cancel = function () {
                             newPropertyDialog.hide();
                         };
+                        
+                        // enable enter to add
+                        newPropertyNameField.on('keydown', function (e) {
+                            var code = e.keyCode ? e.keyCode : e.which;
+                            if (code === $.ui.keyCode.ENTER) {
+                                add();
+                            }
+                        });
 
                         // make the new property dialog draggable
                         newPropertyDialog.draggable({

Reply via email to