开发者

JqGrid inline editing with formatter

开发者 https://www.devze.com 2023-02-13 01:50 出处:网络
I have this column model { name: \'CostShare\', index: \'CostShare\', width: 50, formatter: \'number\', formatoptions: { decimalPlaces: 2, suffix: \"%\" }, resizeable: true, align: \'center\', editab

I have this column model

{ name: 'CostShare', index: 'CostShare', width: 50, formatter: 'number', formatoptions: { decimalPlaces: 2, suffix: "%" }, resizeable: true, align: 'center', editable: true, edittype: 'text', editOptions: { numb开发者_如何学运维er: true} }

which will produce a formatted value 1.00% from the source data of 1. Problem is when I do inline editing it turns the formatted data into a textbox. It creates

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

When you escape to close the editing "session" it probably tries to reformat again and turns the 1.00% into NaN. Do I have to unformat the data manually or shouldn't the grid be doing that?


I had to use the

         unformat: unformatPercent

hook in the colModel. Seems like default format options should auto unformat themselves. If it's just me doing something weird let me know. otherwise this is the answer.


Are you calling editRow() manually in your code? If yes, try to call restoreRow() beforehand

0

精彩评论

暂无评论...
验证码 换一张
取 消