Kalvaitir Posted July 22, 2014 Share Posted July 22, 2014 In the dbgrid as I do that, if the user presses Tab, go to a specific column? Link to comment Share on other sites More sharing options...
Sherzod Posted July 22, 2014 Share Posted July 22, 2014 Can you clarify? Link to comment Share on other sites More sharing options...
Kalvaitir Posted July 23, 2014 Author Share Posted July 23, 2014 I want that when the user clicks the Tab key, if it is in column 1 of DBGrid, it will go to column 5. Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 Hi Kalvaitir. One of the possible solutions: UniDBGrid1 -> ClientEvents -> ExtEvents replace keydown function: function keydown(e) { if (e.keyCode == 9 && this.panel.uniCol == 1) { this.panel.getSelectionModel().setCurrentPosition({row: this.panel.uniRow, column: 5}); } } Does not work if the cell is in edit mode ... Try Best regards 1 Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 Does not work if the cell is in edit mode ... And add this code too. This allows you to move to another column in edit mode: UniDBGrid1 -> ClientEvents -> ExtEvents add reconfigure function function reconfigure(sender, store, columns, oldStore, the, eOpts) { columns[1].editor = {listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } Try... Best regards. Link to comment Share on other sites More sharing options...
Kalvaitir Posted July 24, 2014 Author Share Posted July 24, 2014 thank you very much. As I do in the event OnAfterLoad or OnEnter (uniDBGrid) go for a column? Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 thank you very much. As I do in the event OnAfterLoad or OnEnter (uniDBGrid) go for a column? I'm sorry I did not understand the question ... ie, please clarify again ... Link to comment Share on other sites More sharing options...
Kalvaitir Posted July 24, 2014 Author Share Posted July 24, 2014 The code you posted above has helped me a lot and I need to end, when the form is opened, the focus uniDBGrid already appears in column 5. Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 No problem! (Sorry, that I requested clarification many times!...) function store.load(sender, records, successful, eOpts) { sender.grid.getSelectionModel().setCurrentPosition({row: 1, column: 5}); } Best regards. Link to comment Share on other sites More sharing options...
Kalvaitir Posted July 24, 2014 Author Share Posted July 24, 2014 The reconfigure code did not work. The cursor moves to column 4, then to column 1, then column 4, then column 3. How could I do to combine these two functions: function reconfigure(sender, store, columns, oldStore, the, eOpts) { columns[1].editor = {listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } function reconfigure(sender, store, columns, oldStore, the, eOpts) { columns[1].editor = {selectOnFocus: true}; // for all columns for (var i = 0; i < columns.length; i++) { columns.editor = {selectOnFocus: true}; } } Thank you! Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 Try function reconfigure(sender, store, columns, oldStore, the, eOpts) { columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } function reconfigure(sender, store, columns, oldStore, the, eOpts) { for (var i = 0; i < columns.length; i++) { columns[i].editor = {selectOnFocus: true}; }; columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } Link to comment Share on other sites More sharing options...
Kalvaitir Posted July 24, 2014 Author Share Posted July 24, 2014 I put one under the other, but in time to run the project it fails to open, hangs on 'Loading ...' Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 function reconfigure(sender, store, columns, oldStore, the, eOpts) { columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } OR (Do not need to put one under the other! (Sorry if I do not understand)) function reconfigure(sender, store, columns, oldStore, the, eOpts) { for (var i = 0; i < columns.length; i++) { columns[i].editor = {selectOnFocus: true}; }; columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } Link to comment Share on other sites More sharing options...
Sherzod Posted July 24, 2014 Share Posted July 24, 2014 use: function reconfigure(sender, store, columns, oldStore, the, eOpts) { for (var i = 0; i < columns.length; i++) { columns[i].editor = {selectOnFocus: true}; }; columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } Link to comment Share on other sites More sharing options...
Kalvaitir Posted August 13, 2014 Author Share Posted August 13, 2014 Added the following functions: Keydown function keydown(e) { if (e.keyCode == 9) { this.panel.getSelectionModel().setCurrentPosition({row: this.panel.uniRow+1, column: 4}) } } Reconfigure function reconfigure(sender, store, columns, oldStore, the, eOpts) { for (var i = 0; i < columns.length; i++) { columns.editor = {selectOnFocus: true}; }; columns[1].editor = {selectOnFocus: true, listeners: { specialkey: function(field, e) { if (e.getKey() == e.TAB) { sender.getSelectionModel().setCurrentPosition({row: sender.getSelectionModel().getCurrentPosition().row, column: 5}); } } } }; } It did not work. When the cell is being edited, it goes to the first column and not the fifth column. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 13, 2014 Administrators Share Posted August 13, 2014 In the dbgrid as I do that, if the user presses Tab, go to a specific column? I recommend not to try to implement such a complex functionality, instead re-design your business logic so this will not be needed. Link to comment Share on other sites More sharing options...
Kalvaitir Posted August 13, 2014 Author Share Posted August 13, 2014 What I want is just set the focus to the fifth column of the next line when I press the Tab key. But doing this code, spoils the rest. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now