jQWidgets Forums

jQuery UI Widgets Forums Grid Colum type float comma separator

This topic contains 5 replies, has 2 voices, and was last updated by  GabrielCostaAlves 8 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Colum type float comma separator #86078

    GabrielCostaAlves
    Participant

    Hi, I´m using comma to decimalSeparator, but digit before comma I can´t view.

    My Code.

    var jsonData = [
    {
    “12”: “SmartPhone”,
    “6111”: “10,87”
    }
    ];
    var source = {
    dataType: “json”,
    dataFields: [
    { name: “12”, type: “string” },
    { name: “6111”, type: “float” }
    ],
    localData: jsonData
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxGrid”).jqxGrid(
    {
    source: dataAdapter,
    width: “100%”,
    height: “250px”,
    sortable: true,
    selectionmode: “none”,
    editmode: “selectedrow”,
    columnsResize: true,
    columns: [
    { text: “Description”, width: “100”, dataField: “12” },
    { text: “Decimal”, width: “100”, dataField: “6111” }
    ]

    });

    The value column “Description” is 10, should be 10,87

    Best Regards

    Colum type float comma separator #86079

    GabrielCostaAlves
    Participant

    I solved this issue. The type need ‘string’, not ‘float’.

    But I need other help. When I use $(‘#jqxGrid’).jqxGrid(‘getrowdata’, row);, the value of this column is “10.89”, but the true value is “10,89”, I need get the value with comma.

    Best Regards.

    Colum type float comma separator #86090

    Hristo
    Participant

    Hello GabrielCostaAlves,

    You could achieve this with change on localizationobj.decimalseparator = ",";
    Please, take a look this arcticle.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Colum type float comma separator #86093

    GabrielCostaAlves
    Participant

    Hi, I can´t this. I put localization, doesn´t work.

    When I´m using $(‘#jqxGrid’).jqxGrid(‘getrowdata’, row); the value of this column is “10.89″, but the true value is “10,89″, I need get the value with comma.

    My code using localization:

    var jsonData = [
    {
    “12”: “SmartPhone”,
    “6111”: “10,87”
    }
    ];
    var source = {
    dataType: “json”,
    dataFields: [
    { name: “12”, type: “string” },
    { name: “6111”, type: “string” }
    ],
    localData: jsonData
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#jqxGrid”).jqxGrid(
    {
    source: dataAdapter,
    editable: true,
    width: “100%”,
    sortable: true,
    selectionmode: “none”,
    editmode: “selectedrow”,
    columnsResize: true,
    columns: [
    { text: “Descrição”, width: “100”, dataField: “12” },
    { text: “Decimal”, width: “100”, dataField: “6111”, columntype: ‘numberinput’,createeditor: function (row, column, editor) {editor.jqxNumberInput({decimalDigits: 2, decimalSeparator: ‘,’, inputMode: ‘simple’, spinButtons: false}); }}
    ]
    });

    var localizationobj = {};
    localizationobj.sortascendingstring = “Ordenar Ascendente”;
    localizationobj.sortdescendingstring = “Ordenar Descendente”;
    localizationobj.sortremovestring = “Remover Ordenação”;
    localizationobj.decimalseparator = “,”;
    $(“#jqxGrid”).jqxGrid(‘localizestrings’, localizationobj);

    Colum type float comma separator #86096

    Hristo
    Participant

    Hello GabrielCostaAlves,

    In current case you use type string in your ‘Decimal’ column and you recieve value of type “string”. (need to change to “float”)
    Also only could set cellsformat: 'f2' member of this column. All this settings will affect on visualization of the Grid.
    About the received value need to change with own logic to looks on desire way.
    One work around:

    
    var value = $("#jqxGrid").jqxGrid('getrowdata', 0)['6111'];
    var transformedValue = value.toString().replace('.', ',');
    

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Colum type float comma separator #86099

    GabrielCostaAlves
    Participant

    Hi Hristov.

    It´s work now.

    Tks.

    Best Regards.

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

You must be logged in to reply to this topic.