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.
-
Author
-
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
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.
Hello GabrielCostaAlves,
You could achieve this with change on
localizationobj.decimalseparator = ",";
Please, take a look this arcticle.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comHi, 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);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 setcellsformat: '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 HristovjQWidgets team
http://www.jqwidgets.comHi Hristov.
It´s work now.
Tks.
Best Regards.
-
AuthorPosts
You must be logged in to reply to this topic.