Kalvaitir Posted July 22, 2014 Posted July 22, 2014 In the dbgrid as I do that, if the user presses Tab, go to a specific column? Quote
Kalvaitir Posted July 23, 2014 Author 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. Quote
Sherzod Posted July 24, 2014 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 Quote
Sherzod Posted July 24, 2014 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. Quote
Kalvaitir Posted July 24, 2014 Author Posted July 24, 2014 thank you very much. As I do in the event OnAfterLoad or OnEnter (uniDBGrid) go for a column? Quote
Sherzod Posted July 24, 2014 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 ... Quote
Kalvaitir Posted July 24, 2014 Author 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. Quote
Sherzod Posted July 24, 2014 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. Quote
Kalvaitir Posted July 24, 2014 Author 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! Quote
Sherzod Posted July 24, 2014 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}); } } } }; } Quote
Kalvaitir Posted July 24, 2014 Author Posted July 24, 2014 I put one under the other, but in time to run the project it fails to open, hangs on 'Loading ...' Quote
Sherzod Posted July 24, 2014 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}); } } } }; } Quote
Sherzod Posted July 24, 2014 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}); } } } }; } Quote
Kalvaitir Posted August 13, 2014 Author 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. Quote
Administrators Farshad Mohajeri Posted August 13, 2014 Administrators 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. Quote
Kalvaitir Posted August 13, 2014 Author 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.