Guru N
Guru N

Reputation: 75

how to convert number 99999 to 999.99 in jqGrid?

following is my code but my grid is displaying as 99999.00

 {label: 'AmtLimit',    name: 'amtLimit',        width: 80,            editable: true, 
   //    template: numberTemplate,
 formatter: 'number', align: 'right', sorttype: 'number',
 editrules: {number: true, required: true},
 formatoptions:{ decimalPlaces: 2 },
 editoptions: { maxlength: 9} 

Upvotes: 0

Views: 90

Answers (1)

Farrukh Subhani
Farrukh Subhani

Reputation: 2038

I think you are sending an integer out to grid and it should be sent as double or float to have 999.99

Assume I tell you two statements that

  1. you need to pay me 1000 and you should understand automatically that its 10.00
  2. you need to pay me 10 and you should understand automatically that its 10.00

I think you will agree that 2nd make more sense even if you dont turn it into 10.00 then still its understandable as 10 value which is same.

In your case if JQgrid fails to format data it will have very different meaning which is wrong in general. Data obtained as 9999 and relying on javascript to successfully convert it to 99.99. I suggest your use appropriate data format on server side or whatever is sending data to make sure its in double or float format.

Upvotes: 1

Related Questions