jQWidgets Forums

jQuery UI Widgets Forums Grid Numberinput with decimal values broken

This topic contains 2 replies, has 2 voices, and was last updated by  evr 7 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Numberinput with decimal values broken #96940

    evr
    Participant

    I’m adding this column to my grid:

    var column =
        {
            text: navColumn.text,
            datafield: navColumn.datafield,
            width: navColumn.width,
            align: 'right',
            cellsalign: 'right',
            cellsformat: 'd',
            columntype: 'numberinput',
            createeditor: function (row, cellValue, editor, cellText, width, height) {
                editor.jqxNumberInput({ decimalDigits: 4 });
            }
        }

    I get an editable numeric input with 4 decimal digits. So far, so good.
    Now I want to input the value ‘21.2100’ in a cell. So I select the cell with mouse or keyboard.
    Once selected I start by typing a ‘2’. The cell goes into edit mode and a ‘2’ appears. Great.
    After that I type a ‘1’. But now the value is ‘2.1’. The second input always goes into the decimal places.
    If I just type ‘21.2100’, the values ends up being ‘2.2100’.

    This only happens with cellsformat: ‘d’. On ‘c’ it works fine.
    But I want decimal values. Not a currency.

    I’m running the latest versions of all script files,
    Please help, this makes it impossible for a user to input decimal values without driving them crazy.

    Also, I would like pressing the ‘-‘ key to set the cell into edit mode, and input a ‘-‘ so a user can easily enter negative decimals.
    If I press – now, it just puts the cell into edit mode and selects the value. So users have to press – twice to get a negative value.

    Gr, Erik

    Numberinput with decimal values broken #96960

    Stanislav
    Participant

    Hello Erik,

    Here is what you are looking for:
    https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/defaultfunctionality.htm

    What you are looking for is this probably: (it’s in the ‘columns’ tab)

    initeditor - sets a custom function which is called when the cells editor is opened. The Grid passes 6 parameters to it - row index, cell value, the editor element, cell's text, the pressed char. The function can be used for adding some custom parameters to the editor. This function is called each time an editor is opened.
    
    { text: 'Quantity', datafield: 'quantity', width: 70, cellsalign: 'right', columntype: 'numberinput',
        initeditor: function (row, cellvalue, editor, celltext, pressedChar) {
            editor.jqxNumberInput({ decimalDigits: 0, digits: 3 });
        }
    }

    As for the ‘-‘, I would suggest you taking a look at our Custom Keyboard Navigation. It should be exactly what you need.

    Best Regards,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

    Numberinput with decimal values broken #97115

    evr
    Participant

    Both example result in nothing. The first one has nothing to do with the formatting/editing issue i’m reporting.
    The second one does not work because the numberinput overrides the keyboard navigation of the grid.

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

You must be logged in to reply to this topic.