繁体   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