B4J Question [Solved] AbmTable how to prevent editable cell from break new line when user press enter key

vp2020

Member
Licensed User
BuildTheme:
    theme.Table("tbl1theme").AddCellTheme("row1")
    theme.Table("tbl1theme").Cell("row1").BackColor = ABM.COLOR_WHITE
    theme.Table("tbl1theme").Cell("row1").ForeColor = ABM.COLOR_BLACK
    theme.Table("tbl1theme").Cell("row1").ActiveBackColor = ABM.COLOR_WHITE
    theme.Table("tbl1theme").Cell("row1").Align = ABM.TABLECELL_HORIZONTALALIGN_CENTER
    theme.Table("tbl1theme").Cell("row1").IsEditable = True
    theme.Table("tbl1theme").Cell("row1").InputMask="'alias':'decimal', 'digits': 0, 'rightAlign': false, 'allowPlus': false, 'allowMinus': false ,'min': 0,'max': 5,'numericInput': true"
    theme.Table("tbl1theme").Cell("row1").AllowEnterKey=False

AllowEnterKey is already set to FALSE, but it did not work,
Could anyone tell me how to prevent editable cell from break a new line when user pressed enterkey,
I want editable cell be a non text area cell, how to do this?

Thank you
 

Attachments

  • p1.png
    p1.png
    6.4 KB · Views: 85

alwaysbusy

Expert
Licensed User
Longtime User
With .AllowEnterKey=False, try adding this snippet AFTER you filled the table and refreshed it (so it is flushed to the browser)

B4X:
Dim script As String= $"
    $("td[allownoenter]").bind( "keydown", function(e) {
          if (e.keyCode === 13) {
            e.preventDefault();
        }    
    });
    "$
page.ws.Eval(script, Null)
page.ws.Flush

Alwaysbusy
 
Upvote 0

vp2020

Member
Licensed User
With .AllowEnterKey=False, try adding this snippet AFTER you filled the table and refreshed it (so it is flushed to the browser)

B4X:
Dim script As String= $"
    $("td[allownoenter]").bind( "keydown", function(e) {
          if (e.keyCode === 13) {
            e.preventDefault();
        }   
    });
    "$
page.ws.Eval(script, Null)
page.ws.Flush

Alwaysbusy
Thank you for your help.
your snippet works great, just the way I want.
You are always be the best!
 
Upvote 0
Top