ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: gopigupta on December 13, 2023, 04:41:01 pm
-
Hello,
I am using textarea in pqgrid to enter multi lines in a cell. I want to restrict users to add text only till 5 lines in text area. Is there any way to achieve this?
My code to have text area in cell:-
{
title: "Field value",
width: "300",
dataIndx: "CFValue",
dataType: "string",
editable: true, nodrop: false, nodrag: false,
editor: {
type: "textarea",
attr: "rows=5 cols=58",
style: "resize:both;",
appendTo: 'grid'
},
editModel: {
saveKey: '' //disable or set it to some other key code to free up use of Enter key for line breaks.
},
menuInHide: true, hidden: false,
validations: [{ type: 'maxLen', value: 5000, msg: "Maximum length allowed is of 5000 chars long!" }],
filter: { crules: [{ condition: 'contain' }], conditionList: ['range', 'contain'], labelIndx: 'CFValue' },
},
-
Add init function to column.editor
init: function(ui){
ui.$editor.on('keydown', function(e){
if(e.keyCode == 13 && $(this).val().split("\n").length >= $(this).attr('rows')) {
return false;
}
});
}
-
Thank you for quick response