newsanti Posted February 22 Share Posted February 22 How to setting clientside TunimMemo autoHeight to get width and height with resize event? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22 Share Posted February 22 30 minutes ago, newsanti said: How to setting clientside TunimMemo autoHeight to get width and height with resize event? Hello, Your question regarding the resize event is not very clear. I guess if you are using client-side alignment, you can use layouts. Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 22 Author Share Posted February 22 5 minutes ago, Sherzod said: Hello, Your question regarding the resize event is not very clear. I guess if you are using client-side alignment, you can use layouts. I want TunimMemo to auto height with textlength. Mobile Memo.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22 Share Posted February 22 I will try to check. 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22 Share Posted February 22 1 hour ago, newsanti said: I want TunimMemo to auto height with textlength. This approach may help you: UnimMemo1.ClientEvents.UniEvents -> function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement, textHeight = inputEl.dom.scrollHeight; textarea.setHeight(textHeight); } } } 1 Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 22 Author Share Posted February 22 7 hours ago, Sherzod said: This approach may help you: UnimMemo1.ClientEvents.UniEvents -> function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement, textHeight = inputEl.dom.scrollHeight; textarea.setHeight(textHeight); } } } function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement; textHeight = inputEl.dom.scrollHeight; if textarea.getValue()=='' then //Check when backspace and empty textHeight=30; textarea.setHeight(textHeight); } } } If add condition when backspace not work? How to fix it? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22 Share Posted February 22 1 minute ago, newsanti said: If add condition when backspace not work? How to fix it? ? if textarea.getValue()=='' then //Check when backspace and empty textHeight=30; if (textarea.getValue() == '') { textHeight=30; } 1 Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 22 Author Share Posted February 22 5 minutes ago, Sherzod said: ? if textarea.getValue()=='' then //Check when backspace and empty textHeight=30; if (textarea.getValue() == '') { textHeight=30; } function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement; textHeight = inputEl.dom.scrollHeight; if (textarea.getValue() == '') { textHeight=30; } textarea.setHeight(textHeight); if (textHeight != textarea.getHeight()) then { //check to fire resize not work ? How to fix? ajaxRequest(sender,'_resize',{H: textHeight}); } } } } Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 22 Share Posted February 22 Remove "then" 1 Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 22 Author Share Posted February 22 3 minutes ago, Sherzod said: Remove "then" Thanks. Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 22 Author Share Posted February 22 37 minutes ago, newsanti said: Thanks. 37 minutes ago, newsanti said: Thanks. Finally ..My code completed. function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement; textHeight = inputEl.dom.scrollHeight; if (textarea.getValue() == '') { textHeight=35; } if (textHeight != textarea.getHeight()) { var H1 = textHeight; var H2 = textarea.getHeight(); if (H1<=35*4) { textarea.setHeight(textHeight); } ajaxRequest(sender,'_resize',{newH: H1, oldH: H2}); } } } } 1 1 Quote Link to comment Share on other sites More sharing options...
newsanti Posted February 23 Author Share Posted February 23 On 2/22/2024 at 11:15 AM, Sherzod said: This approach may help you: UnimMemo1.ClientEvents.UniEvents -> function beforeInit(sender, config) { config.listeners = { keyup: function(textarea) { var inputEl = textarea.inputElement, textHeight = inputEl.dom.scrollHeight; textarea.setHeight(textHeight); } } } procedure TMainmForm.UnimFormShow(Sender: TObject); begin UnimMemo1.Clear; UnimMemo1.Lines.Add('TestLine1'); UnimMemo1.Lines.Add('TestLine2'); UnimMemo1.Lines.Add('TestLine3'); UnimMemo1.Lines.Add('TestLine4'); UnimMemo1.Lines.Add('TestLine5'); UnimMemo1.Lines.Add('TestLine6'); UnimMemo1.Lines.Add('TestLine7'); UnimMemo1.Lines.Add('TestLine8'); end; If fill data by code .. How to change height of textarea? This code change only keyup event. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted February 23 Share Posted February 23 Hello, I will try to check. Quote Link to comment Share on other sites More sharing options...
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.