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

Model Documentation

6 Answers 190 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 29 Mar 2012, 08:05 PM
Is there any documentation on the Model? I see it for DataSource, but I know there are things involved, but I cannot find a good source of info on it. Such as things we can decorate the individual fields with...

6 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 30 Mar 2012, 11:48 AM
Hello Joshua,

You could check this example from the documentation - it explains how to describe the model and the data fields. If you still have troubles with the model configuration, please specify what exactly problems you are encountering and I will try to help to resolve them.

Greetings,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 1
answered on 30 Mar 2012, 04:37 PM
I have been reading that same post over and over since I started exploring kendo. I may have it memorized at this point. :)
My main problem is that I want an editable grid that has dates in it, but i need to replace the row template to add some styling to the individual cells. After I edit a date cell, I cannot format it when it comes back. I tried to use parse, but it never hits the function.

I have created a basic sample to illustrate my challenge.

http://jsfiddle.net/WBLPp/ 
0
Alexander Valchev
Telerik team
answered on 02 Apr 2012, 10:42 AM
Hello Joshua,

The problem that you are experiencing is not connected to the model - it is caused by the fact that the editing functionality does not work well with rowTemplates. If it is possible, I would recommend to use column templates and CSS styling.

As a general information, the model configuring from your example looks OK, but it is not applied to the dataSource.
//only the data array is passed to the dataSource object
dataSource: dsQuarter
 
//I suggest to use similar to the following code
dataSource: {
    data: dsQuarter,
    schema: {
        model: {
        //your model
        }
    }
}


Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Joshua
Top achievements
Rank 1
answered on 02 Apr 2012, 03:05 PM
I will work with my designer to see if he can accomplish the desired functionality, but I am not sure if he will be able to do it, which was why he settled on the rowtemplate. This however does not fix the need for actual documentation on the Model. It is a very large piece of the framework and it feels like it has so many options that go with it, but no documentation on what they are.
0
Maksym
Top achievements
Rank 1
answered on 03 Apr 2012, 04:55 AM
Spent an hour trying to figure out how to set a property using undocumented "set" method.

Please add documentation of model object.

Also it would be nice to have some practical examples with grid data validation and how to handle errors while saving updated grid data to server.
0
Hammad
Top achievements
Rank 1
answered on 13 Apr 2012, 12:44 PM
How can i set the value of a field in a model?

I have following Model:

ProductID | Quantity | UnitPrice | TotalPrice

in the save event of Grid, i am using jQuery ajax call to update quantity to the server. After that i need to update the Total Price

I am trying:

$("#cart_results").kendoGrid(
{
   
//some config of grid,
    //save event handler
    save: function (e)
    {
         //after my ajax call
         e.model.set("TotalPrice",e.model.UnitPrice * e.values.Quantity);
    }
    //some other config of grid
}


but it still shows old value of TotalPrice

Console of Safari shows no errors
Tags
Data Source
Asked by
Joshua
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Joshua
Top achievements
Rank 1
Maksym
Top achievements
Rank 1
Hammad
Top achievements
Rank 1
Share this question
or