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

4 posts, 1 answers
  1. Paul
    Paul avatar
    24 posts
    Member since:
    Aug 2013

    Posted 28 Aug 2014 Link to this post

    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.
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 29 Aug 2014 Link to this post

    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!
     
  3. Paul
    Paul avatar
    24 posts
    Member since:
    Aug 2013

    Posted 29 Aug 2014 in reply to Vladimir Iliev Link to this post

    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.
  4. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 29 Aug 2014 Link to this post

    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!
     
Back to Top