jQWidgets Forums

jQuery UI Widgets Forums Grid Comma decimal separator

This topic contains 4 replies, has 2 voices, and was last updated by  Peter Stoev 12 years, 4 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Comma decimal separator #12657

    alexz
    Member

    Hi,

    just upgraded to 2.5.5, but issues with comma decimal separator persist. Now comma is visible in numberinput editor, but when editor is closed, cells value is 0, likely because of the following code:

    				case "numberinput":
    if (this.editcell.editor.jqxNumberInput) {
    var c = this.editcell.editor.jqxNumberInput("getDecimal");
    f = new Number(c);
    f = parseFloat(f);
    if (isNaN(f)) {
    f = 0;
    }
    if (d.displayfield != d.datafield) {
    f = { label: f, value: f };
    }
    }
    break;
    }

    c comes in as comma separated decimal (12,67) and Number fails to convert it to number.

    Do you have any workaround?

    Br. Alex

    Comma decimal separator #12664

    Peter Stoev
    Keymaster

    Hi alexz,

    Please, send us a sample which reproduces the reported behavior. We would be glad to test it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Comma decimal separator #12711

    alexz
    Member

    The column declaration:

    {text: 'Korkeus', datafield: 'Height',
    cellsrenderer: function (row, column, value, defaultHtml, columnProperties) { return decimalDisplayColumnRenderer (row, column, value, defaultHtml, columnProperties); }, columntype: 'numberinput',
    createeditor: function (row, value, editor) { editor.jqxNumberInput({ decimalSeparator: ',', groupSeparator: ' ' }); }}

    The renderer function (not important, createeditor seems to be the main cause)

    var decimalDisplayColumnRenderer = function(row, column, value, defaultHtml, columnProperties) {
    var element = $(defaultHtml);
    var content = jQuery.global.format(value, 'n');
    element.text(content);
    if (element.length > 0) {
    return element[0].outerHTML;
    }
    return content;
    };
    Comma decimal separator #12713

    alexz
    Member

    Currently I got rid of the error by stabbing the library file jqxgrid.edit, but it’s always bad idea:

    				case "numberinput":
    if (this.editcell.editor.jqxNumberInput) {
    var c = this.editcell.editor.jqxNumberInput("getDecimal");
    // TODO: library modification!
    if (c != null || c != '') {
    c = c.replace(this.editcell.editor.jqxNumberInput("decimalSeparator"), ".");
    c = c.replace(this.editcell.editor.jqxNumberInput("groupSeparator"), "");
    }
    f = new Number(c);
    f = parseFloat(f);
    if (isNaN(f)) {
    f = 0;
    }
    if (d.displayfield != d.datafield) {
    f = { label: f, value: f };
    }
    }
    break;
    }
    Comma decimal separator #12717

    Peter Stoev
    Keymaster

    Hi alexz,

    Thanks for the input. We will take a look into that code.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.