I have input field which contains decimal and special characters e.g. comma
and dot while calulating the maxLength of the field i want to skip special characters :
{
name: "amount",
width: 62,
template: "number",
formatter: "number",
formatoptions: {
decimalSeparator:",",
thousandsSeparator: " ",
decimalPlaces: 4,
defaultValue: '0.0000'
},
editoptions: {
maxlength; 5
type: "number"
}
},
I when edit inline record filed "PackageCode" is count decimalSeparator I want don't count decimalSeparator
see demo :https://jsfiddle.net/dnfk8hmr/288/
I'm not sure that I understand what you need to implement. jqGrid don't count decimalSeparator
or anything else during inline editing. It just set static value of maxlength
, which you use (maxlength="5"
). If you need to allows to edit more long values, like 125.22
in your demo, then you can set maxlength
dynamically like in the demo https://jsfiddle.net/OlegKi/dnfk8hmr/309/, which used
editoptions: {
maxlength: 5,
dataInit: function (elem, options) {
var currentLength = String(elem.value).length;
if (currentLength > 5) {
elem.setAttribute("maxlength", currentLength);
}
}
}
Additionally you should fix defaultValue
to use comma instead of dot (0,00
instead of 0.00
or 0,0000
instead of 0.0000
) if you use formatter option decimalSeparator:","
.