2011-02-24 84 views
0

的jqGrid聯編輯我有此列模型與格式化

{ name: 'CostShare', index: 'CostShare', width: 50, formatter: 'number', formatoptions: { decimalPlaces: 2, suffix: "%" }, resizeable: true, align: 'center', editable: true, edittype: 'text', editOptions: { number: true} } 

這將產生從1.問題的源數據1.00%格式化值,當我做直列編輯它把格式化的數據到文本框。它創建了

<td aria-describedby="AdminCostTable_CostShare" title="1.00%" style="text-align: center;" role="gridcell"><input type="text" style="width: 98%;" id="1_CostShare" name="CostShare" role="textbox" class="editable"></td> 

當您退出以關閉編輯「會話」時,它可能會嘗試重新格式化並將1.00%變爲NaN。我是否必須手動對數據進行非格式化,否則網格不應該這樣做?

回答

2

我不得不使用

  unformat: unformatPercent 

鉤在colModel。看起來像默認格式選項應該自動自動格式化。如果只是我在做一些奇怪的事情讓我知道。否則這就是答案。

0

你是否在代碼中手動調用editRow()?如果是,嘗試調用restoreRow()事先

+0

我會調用editrow和restoreRow。我不得不添加一個有點笨拙的無格式函數。 – Steve 2011-03-22 17:19:38