jQuery UI Widgets › Forums › General Discussions › Plugins › AngularJS › jqxgrid with editable number input – clear value and keep it null
Tagged: angular grid, angular2 grid, bootstrap grid, javascript grid, jquery grid, jqwidgets grid, jqxgrid, typescript grid
This topic contains 2 replies, has 2 voices, and was last updated by badera 8 years, 12 months ago.
-
Author
-
November 18, 2016 at 12:18 pm jqxgrid with editable number input – clear value and keep it null #89144
I need a jqxGrid, where we have an editable number column. The numbers can be set or not set i.e. nothing displayed in the cell.
(since my code example is angularjs, I posted it here)The first problem was how to achieve that we can clear the value in a general jqxNumberInput by pressing delete key.
I found this forum post: http://www.jqwidgets.com/community/topic/allownull-and-clearing-value-on-keyup/
with this solution: http://jsfiddle.net/txhi/fp1zwg7k/I thought that I can adapt it easily to the jqxNumberInput in my grid editor.
As you can see in the linked example below, it basically works; the value can be deleted by pressing delete key but as soon as we exit the editor by clicking outside of the grid, 0.00 is set again. Why? I explicitly setallowNull: truein theiniteditorfunction.
https://www.jseditor.io/?key=grid-input-editor-clear-valueThere is even a second problem: If we once pressed delete, we can no more enter numbers unless the cell editing is finished (i.e. editor closed) and cell is brougth in edit mode again. This is also no problem in the fiddle linked above (http://jsfiddle.net/txhi/fp1zwg7k/).
Please help me getting this to work as expected!
Thank you in advance.
Best regards,
– baderaNovember 22, 2016 at 9:38 am jqxgrid with editable number input – clear value and keep it null #89218Hello badera,
Please, could you try this approach as at this sample:
$('#' + editor[0].id + ' input').keydown(function (event) { if (event.keyCode === 46) { $('#' + editor[0].id).val(null); } })Hope this helps.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comNovember 22, 2016 at 10:32 am jqxgrid with editable number input – clear value and keep it null #89220Hello Hristo
Thank you very much. It works like a charm!
Best regards,
– badera -
AuthorPosts
You must be logged in to reply to this topic.