I have Requirement like this.i should show format like 9999.000 in kendoNumericTextBox with in the grid how to do it ..
note :After decimal point It should accept Only 3 zeros(3 decimal Points)
you can specify format in column specification :
{ field: "fieldName",type:"number", format: "{0:n3}" }
I solved my problem like this:
.kendoNumericTextBox({
placeholder: "select value",
format: "#.000"
});
Related
I am having kendo mvc grid and one of its column is numeric text box and it is of type integer , but when I try to give decimal values to numeric text box ,it is becoming zero , but it should get rounded to nearest integer or should not accept decimal values.
How can i do that , kindly anyone help me
CODE:
columns.Bound(c => c.Quantity).Title("Quantity").Width(100);
public int Quantity { get; set; }
I have a vuetify Data-table with multisort enabled like so:
<v-data-table
ref="insuranceTable"
:headers="headers"
:items="getRows"
:sort-by="['created']"
:sort-desc="[true]"
multi-sort
:search="search"
:items-per-page="10"
>
one of the columns in the table is Insurance Type. this value is fetched by using an index like this {{insuranceType[item.code]}}. The insuranceType array is defined as follows:
insurancetype:[
this.$t('insuranceType.life'),
this.$t('insuranceType.health'),
this.$t('insuranceType.property'),
]
The values are displayed in the data-table without any issue. However, When I try To sort the table by Insurance Type Column, nothing happens. The Sorting works for all other columns. The sorting works for Insurance Type column if I use a non i18n array like this:
insurancetype:['life','health','property']
How can I configure the V-Data-Table so it can be sorted by columns with i18n values?
You can define a custom sorting function for the Insurance Type column in your headers array. I've used this method before to be able to sort some custom string dates formats like this:
headers: [
{
text: 'Created date',
value: 'created_at',
align: 'center',
sort: (a, b) => {
var date1 = a.replace(/(\d+)\/(\d+)\/(\d+)/, '$3/$2/$1')
var date2 = b.replace(/(\d+)\/(\d+)\/(\d+)/, '$3/$2/$1')
return date1 < date2 ? -1 : 1
}
},
...
]
You should be able to add your own logic to be able to sort those. Can you replicate the issue in a codesanbox or codepen?
I want my Kendo Grid decimal column to value like 12,52,36,536.00. How can I format the column?
First you need set proper culture for that format (in your case is similar to en-US):
kendo.culture("en-US");
Then set format {0:n2} to the grid column (n2 means 2 decimal places):
$("#grid").kendoGrid({
columns: [ {
...
format: "{0:n2}"
} ... ],
...
});
I have a column in grid with type of float and I would like to have numbers displayed without 'e'. Is that possilbe?
e.g.
I don't want -1e-7, but -0.0000001.
What format should I use for that column?
Found a solution. The problem is in Kendo DataSource, which automatically converts this kind of data. The solution is to have column template which would enforce formatting of value.
column.template = function(val) {
return kendo.toString(parseFloat(val[column.name]), '#.#######');
}
Date column is created using colmodel below.
This column shows values like 0101.0101.7070 for every date column.
if formatter:date is removed, date is correct.
How to show normal date values with formatter:date ?
{ "name":"Date",
"formatter":"date",
"datefmt":"dd.mm.yyyy",
"formatoptions":{"newformat":"dd.mm.yyyy"},
"editable":true
}
Update.
Data is passed from server using json in same dd.mm.yyyy format like
{"total":2,"page":1,"records":57,"rows":
[{"id":"9279","cell":["9279","42","","10.08.2011","","","","False"]},
{"id":"9278","cell":["9278","41","","12.08.2011","","","","False"]},
...
Using d.m.y formats in column options as suggested shows proper dates but with 2 year digits only..
I'm looking for a 4-digit year numbers. I tried d.m.yyyy format but this shows 8 digit year numbers and 1 for month and day as 01.01.70707070
I also tried to add srcformat: 'dd.mm.yyyy' to formatoptions but this does not change the wrong result.
To display the day as the number you should use j or d. For the displaying month as the number you should use n or m. The d and m includes 0 padding at the beginning if needed. The 'y' means two digit year format and Y means four digit year.
So you probably need srcformat: 'd.m.Y' or srcformat: 'j.n.Y'.
Use d.m.y instead of dd.mm.yy ,