jQuery UI Widgets Forums Angular Numberinput auto generate value 0

This topic contains 5 replies, has 2 voices, and was last updated by  ilywanzi 1 month, 3 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Numberinput auto generate value 0 #112198

    ilywanzi
    Participant

    Hi, I am using Numberinput component inside grid component, and this is the config in createeditor:

    editor.jqxNumberInput({
       spinButtons: false,
       allowNull: true
    });

    In the grid, one of the column’s type is numberinput, and their default value is null. If user click any empty cell in that column, then click outside of the cell(not type anything in the cell), the cell value will be changed to 0. Why this happen? How can I avoid this action? Thanks.

    Numberinput auto generate value 0 #112206

    Martin
    Participant

    Hello ilywanzi,

    Please, take a look at the following Example (the “Quantity” column).

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com

    Numberinput auto generate value 0 #112217

    ilywanzi
    Participant

    Hi, Martin, thanks for your reply!
    In your code, I found a problem, if I type 0 in one cell of the Quantity column, then this 0 can’t save in the cell.

    I found the root of this problem is, editor.val() will auto generate a 0 if that cell is null.
    In generatedata.ts, I set row['quantity'] = null. Then, when I click a Numberinput cell, and print the values of editor.val() and cellvalue from geteditorvalue(row: number, cellvalue: any, editor: any), the result are 0 and null.

    So is there a way to stop auto generating 0 by Numberinput component? Thanks.

    Numberinput auto generate value 0 #112218

    ilywanzi
    Participant

    Hi, Martin, BTW, where can I check the whole list of those column config functions such as createeditor, initeditor, and geteditorvalue?
    Thanks.

    Numberinput auto generate value 0 #112229

    Martin
    Participant

    Hello ilywanzi,

    Could you check the Example again now.
    I have added valueChanged event handler for the number input so the value could update when you type 0.

    You can check all column’s properties in the Angular Grid API Documentation and in the JQuery Grid API Documentation you can also find descriptions for all of them and some examples.

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com

    Numberinput auto generate value 0 #112237

    ilywanzi
    Participant

    Hi Martin, your solution is work! Thanks, really appreciate!

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.