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

SchedulerEvent.options.fields.fieldName.parse() is not passed any data

3 Answers 178 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 28 Aug 2014, 02:23 PM
I'm trying to create a title for my scheduler events which is composed of multiple different parts of the data for the event. The parse field seemed like a good choice as you can assign it a function, which is then called in order to parse the data. Unforuntately, this function is never passed any data at all which makes it impossible to use as designed, unless I'm missing something?

Example:

http://jsbin.com/siciqoyiteyo/1/

In this example I have:

schema: {
             model: {
               fields: {
                 employee_uid: { defaultValue: "1" },
                 title: { parse: function(anything){ return ""+ anything}},
                 notes: { type:"string"}
               }
             }             
           }
but as you can see in the demo, the title is always "undefined".

Hope you can help.

Cheers, Paul.

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 29 Aug 2014, 05:43 AM
Hi Paul,

Current behavior is expected as the data doesn't contain "title" field. In current case you should additionally define from which field the value should be get:

title: { parse: function(anything){return ""+ anything}, from: "notes"},

For convenience I updated the previous example to work as expected:
Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Paul
Top achievements
Rank 1
answered on 29 Aug 2014, 08:17 AM
Hi Vladimir,

That isn't really a solution to my problem. I need to create a title string for each element from a combination of fields, not just from one. For that I was hoping to use the parse function like this: 

parse: function(data) { return data.employee_uid + data.notes }


But as I demonstrated, parse() is not passed any data to work with.

In addition, with your solution you will notice that when you click on any of the entries already in the scheduler, the 'notes' field does not get populated in the editor with any data.

Cheers, Paul.
0
Accepted
Vladimir Iliev
Telerik team
answered on 29 Aug 2014, 09:59 AM
Hi Paul,

If you need to access another properties from the model than the "model.parse" method is not the right place - in current case you should use the dataSource "schema.parse" method:

Kind Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Paul
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Paul
Top achievements
Rank 1
Share this question
or