allenchow Posted November 15, 2016 Posted November 15, 2016 How to get tab spacing when pressing TAB inside unidbmemo component ? Thanks! Quote
Sherzod Posted November 15, 2016 Posted November 15, 2016 Hi, For now can you try this approach?!: For example for UniMemo, UniMemo1 -> ClientEvents -> ExtEvents -> keydown fn: function keydown(sender, e, eOpts) { if (e.keyCode === 9) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + '\t' + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; return false; } } Best regards. Quote
allenchow Posted November 15, 2016 Author Posted November 15, 2016 Hi, For now can you try this approach?!: For example for UniMemo, UniMemo1 -> ClientEvents -> ExtEvents -> keydown fn: function keydown(sender, e, eOpts) { if (e.keyCode === 9) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + '\t' + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; return false; } } Best regards. Yes, it works. But will lost focus afterwards. Any additional steps ? Thanks ! Quote
allenchow Posted November 15, 2016 Author Posted November 15, 2016 It's ok now. Just disable tabstop . Thanks !! Quote
allenchow Posted January 26, 2017 Author Posted January 26, 2017 It's weird that it doesn't work again , maybe after upgrade to 1.0 beta ? When I press <TAB> inside the dbmemo, it lost focus , but when I click the dbmemo again, it stops at the new tab position .... Please check . Thanks ! Quote
Sherzod Posted January 26, 2017 Posted January 26, 2017 Can you try this approach for now?!: function keydown(sender, e, eOpts) { if (e.keyCode === 9) { var val = this.value, start = this.inputEl.dom.selectionStart, end = this.inputEl.dom.selectionEnd; this.setValue(val.substring(0, start) + '\t' + val.substring(end)); this.inputEl.dom.selectionStart = this.inputEl.dom.selectionEnd = start + 1; Ext.defer(function(){ sender.focus(false); }, 10); return false; } } Quote
allenchow Posted January 27, 2017 Author Posted January 27, 2017 Yup, inside firefox it's ok... Quote
Sherzod Posted January 27, 2017 Posted January 27, 2017 seems it is a bug in Chrome Can you check in here too?!: http://jsfiddle.net/jz6J5/ Quote
allenchow Posted January 27, 2017 Author Posted January 27, 2017 but it works with this example Quote
Sherzod Posted January 27, 2017 Posted January 27, 2017 Then pls, can you make a small test case for this?! 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.