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

Grid's numeric column does not render editor

4 Answers 258 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gergo
Top achievements
Rank 1
Gergo asked on 24 Apr 2012, 10:54 AM
Hi,

I have a strange error with Kendo Grid. I have a model defined :

var allocationGridModel = new kendo.data.Model({
           id: "Symbol",
           fields: {
               IsCheckedForDelete: { type: "boolean" },
               AssetClassCode: { type: "string", editable: false, nullable:false },
               AssetClassColor: { type: "string", editable: false, nullable:false  },
               Symbol: { type: "string", editable: false, nullable:false  },
               SecurityDescription: { type: "string", editable: false, nullable:true  },
               TargetAllocation: { type: "number", editable: true, validation: { min: 0.01}, nullable:false  },
               DriftMin: { type: "number", editable: true, nullable:false  },
               DriftMax: { type: "number", editable: true , nullable:false },
               MinBuyWeight: { type: "number", editable: true, nullable:true  },
               MinBuyValue: { type: "number", editable: true , nullable:true },
               MinSellWeight: { type: "number", editable: true, nullable:true  },
               MinSellValue: { type: "number", editable: true , nullable:true },
               SellOrder: { type: "number", editable: true, nullable:false  },
               IsInFavorites: { type: "boolean", editable: false,nullable:true },
               Equivalences : {type : "string", editable:false,nullable:true }
           }
       });

I have a grid which uses this model. In the grid I have rowTemplates defined. What I observed is, if in one of the columns which is editable, I put a 0 value and after, if I try to re-edit the same cell afterwards the numeric text box in the grid cell is not rendered. In some cases a simple input is rendered in other cases the value 0 disappears and no control is displayed in the cell.

Here is the column definition for the marked column in the attached image:

{
          field: "MinBuyWeight",
          title: "Min Buy Weight",
          template: '<div style="text-align:right;">#= kendo.toString(MinBuyWeight,"0.00") # % OR</div>',
          width: "90px"
      }

Do you have any kind of ideas what am I doing wrong?

Thanks in advance!!

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 27 Apr 2012, 08:20 AM
Hi Gergo,

I suspect that the behavior you have described is caused by incorrect model definition. Looking at the snippet you have pasted it seems that you are creating a Model instance instead of defining a model declaration. Thus, you should change it to something similar to the following:

         var AllocationGridModelType = kendo.data.Model.define({
           id: "Symbol",
           fields: {
               IsCheckedForDelete: { type: "boolean" },
               AssetClassCode: { type: "string", editable: false, nullable:false },
               AssetClassColor: { type: "string", editable: false, nullable:false  },
               Symbol: { type: "string", editable: false, nullable:false  },
               SecurityDescription: { type: "string", editable: false, nullable:true  },
               TargetAllocation: { type: "number", editable: true, validation: { min: 0.01}, nullable:false  },
               DriftMin: { type: "number", editable: true, nullable:false  },
               DriftMax: { type: "number", editable: true , nullable:false },
               MinBuyWeight: { type: "number", editable: true, nullable:true  },
               MinBuyValue: { type: "number", editable: true , nullable:true },
               MinSellWeight: { type: "number", editable: true, nullable:true  },
               MinSellValue: { type: "number", editable: true , nullable:true },
               SellOrder: { type: "number", editable: true, nullable:false  },
               IsInFavorites: { type: "boolean", editable: false,nullable:true },
               Equivalences : {type : "string", editable:false,nullable:true }
           }
       });

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!
0
Gergo
Top achievements
Rank 1
answered on 02 May 2012, 12:05 PM
Hi Rosen,

I've done as you suggested(create model with kendo.data.Model.define()), but the problem persists .
I am pretty sure that it has to do something with the 0 value. 
In the model I have the field set as nullable, but after assigning the 0 value to that field, afterwards it can't be edited.

Do you have any other ideas ?

Thanks in advance,
Gergő

0
Rosen
Telerik team
answered on 02 May 2012, 02:09 PM
Hello Gergo,

Could you please open a support ticket and provide a simple jsFiddle test page in which the issue you are experiencing can be observed?

Regards,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gergo
Top achievements
Rank 1
answered on 03 May 2012, 06:12 AM
Hi Rosen,

Finally the problem was resolved. The problem was, that I had a model defined for the datasource, but the model was assigned to kendoGrid's schema property not to the datasource. As soon as the  model was assigned to the datasource and not to the grid, the controls were rendered correctly.

Thank you very much for your help.

Regards,
Gergő
Tags
Grid
Asked by
Gergo
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Gergo
Top achievements
Rank 1
Share this question
or