Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1010
igNumericEditor is not accepting more than 2 decimals in igGrid column
posted

Hi Support,

I created an igGrid with 1 row. Inside I have defined two columns for prices, and the columns I've tried to set the options for the numeric editor. I've set the minDecimals and maxDecimals to 4 and 5, respectively. I've also defined the formatting on the columns as "##0.0000".

However, if I try to place a number, say 1.0125, it displays the price as 1.0100. I am not sure what other setting I need to place. Also, I've tried adding buttonType: "spin" and spinDelta: 0.005, but no spinner shows up in the cell on edit.

I am not sure how to proceed. I've placed the javascript defining the grid below:

$("#bidasktable").igGrid({
    width: "100%",
    autoAdjustHeight: true,
    autoGenerateColumns: false,
    autoCommit: true,
    caption: "Bid/Ask",
    renderCheckboxes: true,
    primaryKey: "Key",
    columns: [
        { headerText: "Key", key: "Key", width: "0%", dataType: "number", hidden: true },
        { headerText: "IOI", key: "IsBidIOI", width: "15%", dataType: "bool" },
        { headerText: "Qty", key: "BidQuantity", width: "15%", dataType: "number", format: "int" },
        { headerText: "Bid", key: "BidPrice", width: "20%", dataType: "number", format: "##0.0000" },
        { headerText: "Ask", key: "AskPrice", width: "20%", dataType: "number", format: "##0.0000" },
        { headerText: "Qty", key: "AskQuantity", width: "15%", dataType: "number", format: "int" },
        { headerText: "IOI", key: "IsAskIOI", width: "15%", dataType: "bool" },
    ],
    features: [
        {
            name: "Selection",
            mode: "row",
            multipleSelection: false
        },
        {
            name: "Resizing",
            allowDoubleClickToResize: true,
            deferredResizing: false
        },
        {
            name: "Updating",
            enableAddRow: false,
            enableDeleteRow: false,
            editMode: "cell",
            horizontalMoveOnEnter: true,
            columnSettings: [
                { columnKey: "IsBidIOI", editorType: "checkbox" },
                {
                    columnKey: "BidQuantity",
                    editorType: "numeric",
                    editorOptions: [
                        { dataMode: "int" }
                    ]
                },
                {
                    columnKey: "BidPrice",
                    editorType: "numeric",
                    editorOptions: [
                          {
                              dataMode: "double",
                              minDecimals: 4,
                              maxDecimals: 5
                          }
                    ]
                },
                {
                    columnKey: "AskPrice",
                    editorType: "numeric",
                    editorOptions: [
                          {
                              dataMode: "double",
                              minDecimals: 4,
                              maxDecimals: 5
                          }
                    ]
                },
                {
                    columnKey: "AskQuantity",
                    editorType: "numeric",
                    editorOptions: [
                        { dataMode: "int" }
                    ]
                },
                { columnKey: "IsAskIOI", editorType: "checkbox" },
            ]
        },
    ]
});

Can you please advise?

Thanks!

Parents
No Data
Reply
  • 15320
    Verified Answer
    Offline posted

    Hello C R,

    I looked at your code and noticed that you've defined editorOptions as an array, however it's an object, so you should remove the "[ ]" braces and the editorOptions object should look like this:

    editorOptions: 
        {
             dataMode: "double",
             minDecimals: 4,
             maxDecimals: 5
        }  

    Please let me know if you have further questions.

    Regards,

    Tsanna

Children
No Data