PDA

View Full Version : Limit the number of lines entered in ExtJS Textarea



webfriend13
15 May 2014, 1:55 AM
Check below code or this url : http://jsfiddle.net/webfriend13/yZHnm/9/ . How can we limit numbers of lines that is allowed to enter in ExtJS TextArea. Does ExtJs provides something out of the box ?


Ext.onReady(function () {
Ext.create('Ext.window.Window', {
height: 60,
layout: 'anchor',
minHeight: 60,
width: 200,
items: [{
grow: true,
anchor: '100%',
flex: 1,
enableKeyEvents : true,
xtype: 'textareafield',
listeners: {
keydown: function (txtArea, e, eOpts) {
//console.log(e.getKey());
if (e.keyCode == 13 && txtArea.value.split("\n").length >= 5) {
console.log('unable to stop :( ');
return false;
}
}
}
}]
}).show();
});

Gary Schlosberg
16 May 2014, 4:03 PM
I don't believe there is any out-of-the-box config that will do this.