簡體   English   中英

使用格式化程序進行JqGrid內聯編輯

[英]JqGrid inline editing with formatter

我有這個列模型

{ 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。 我是否必須手動取消格式化數據,或者網格不應該這樣做?

我不得不使用

         unformat: unformatPercent

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM