Search code examples
jqueryjqgrid

JqGrid editrules number true does not work


I need to prevent letters from being saved to a numeric field in jqgrid, I'm using inlineEditing in jqGrid.

I can check if the field was filled with the property

editrules : {required: true}

Following the documentation I put the property "number: true"

editrules : {required: true, number: true}

But it doesn't work. My jqGrid version is 4.5.4, my colModel is below

colModel : [
    {formatter:"integer",index:"PK_FACTIVEL",search:true,hidden:false,sorttype:"integer",sortable:true,width:10,align:"right",name:"PK_FACTIVEL",editrules:{number:true,required:true},editable:true},
....
]

Solution

  • I discovered the problem.

    My colModel is generated from information saved in the database,

    The property "editrules : {number: true}" comes from a JSON

    and was "editrules" : {"number ": "true"},

    this space was causing me problems. Thanks Tommy for help!!!