jQuery UI Widgets › Forums › Grid › jqxNumberInput editor in grid with cellsformat f2
Tagged: cellediting, cellsformat, jqxgrid, jqxnumberinput
This topic contains 1 reply, has 1 voice, and was last updated by mohamedazher 9 years, 5 months ago.
-
Author
-
Hi,
There seems to be a weird behaviour when you use a jqxNumberInput for cell editing with cellsformat f2.
eg:
columns: [ { text: 'First Name', columntype: 'textbox', datafield: 'firstname', width: 120 }, { text: 'Last Name', datafield: 'lastname', columntype: 'textbox', width: 120 }, { text: 'Product', columntype: 'dropdownlist', datafield: 'productname', width: 195 }, { text: 'Available', datafield: 'available', columntype: 'checkbox', width: 67 }, { text: 'Price', datafield: 'price', align: 'right', cellsalign: 'right', cellsformat: 'f2', columntype: 'numberinput', validation: function (cell, value) { if (value < 0 || value > 15) { return { result: false, message: "Price should be in the 0-15 interval" }; } return true; }, createeditor: function (row, cellvalue, editor) { editor.jqxNumberInput({ digits: 3 }); } } ]
Notice the cellsformat: ‘f2’ on the price column. When you use this on a grid and click on the price cell and type 223, it types 2.23. You cannot enter more than 1 digit before the decimal point. To type more, you need to move the cursor again before the decimal point and then type, needless to say this is very inconvenient. Just makes it difficult to enter any value.
This issue does not happen when the column has cellsformat: ‘c2’. This is only a problem when you use cellsformat:’f2′
Simple way to test is to use the cellediting.htm example http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/cellediting.htm?arctic and just change the cellsformat on the price column from c2 to f2.
Is there a way to fix this issue? A temporary workaround seems to be to use cells for c2, but using this on a non currency column is not possible as it prints the $ symbol before the value.
Regards,
Mohamed Azherhi,
For those who are facing this issue, there is a workaround. Try setting the property symbol: ‘ ‘ to the jqxNumberInput.
Setting symbol to a blank space (‘ ‘ not ”) solves the issue.
Eg: editor.jqxNumberInput({ digits: 3,symbol: ‘ ‘});
Regards,
Mohamed Azher -
AuthorPosts
You must be logged in to reply to this topic.