This is a migrated thread and some comments may be shown as answers.

Setting step size in KendoGrid

1 Answer 335 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 04 Dec 2011, 03:09 PM
Hello everybody :)

I am using KendoGrid to perform some CRUD operations on my database. I have a field set as "number", so Kendo is diplaying buttons for increasing and decreasing its value (as the example showed here)

I want to change the step size, by the following code:

$("#seasons_grid").kendoGrid({
        dataSource: dataSource,
        navigatable: true,
        pageable: true,
        height: 400,
        toolbar: ["create", "save", "cancel"],
        columns: [
        {
            field: "name",
            title: title_nombre
             
        },
        {
            field: "percentage",
            format: "{0:p}",
            step: "0.1",
            title: title_porcentaje
        },
        {
            field: "start_date",
            title: title_fecha_inicial,
            template: '#= kendo.toString(start_date, "'+formatDate+'")#'
        },
        {
            field: "end_date",
            title: title_fecha_final,
            template: '#= kendo.toString(end_date, "'+formatDate+'")#'
        },
        {
            command: "destroy",
            title: " ",
            width: "110px"
        }],
        editable: true
    });

Nevertheless, it is not working as the upper arrow increases the value in one unit, and it must be increased in 0.1 (as a percentage).

Thanks in advance :)

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 05 Dec 2011, 02:48 PM
Hi Carlos,

You can set the step through the model declaration:

var dataSource = new kendo.data.DataSource({
     transport: {
          //...
     },                          
     schema: {
         model: {
             id: "ProductID",
             fields: {                                      
                 UnitPrice: { type: "number", validation: { required: true, min: 1, step: 2} },
                  //..
             }
         }
     }
 });

Unfortunately, in current version of the grid editing functionality, the step options can be set only in full steps, thus floating points numbers are not supported. However, it managed to address this limitation and it will be supported for the next version of the widget.All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Carlos
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or