Apply filter on a second resource

3 posts, 0 answers
  1. Luca
    Luca avatar
    7 posts
    Member since:
    Nov 2015

    Posted 24 Nov 2015 Link to this post

    Hello!
    I have a problem with filters in my scheduler: as shown in your base example,

    I use a first filter applied on a member field called LabelTypeID (the same as OnwerID in your example).

    My Model has a second (int ?) member called LabelID
    In some case I have to filter only the LabelID (to select a single label, associated to the Calendar Event)

    So, in my template I added a second resource for the LabelID, where the binding returns all possible labels:

    .Resources(resource =>
     
      {
     
          resource.Add(m => m.LabelTypeID)
     
          .DataTextField("Text")
     
          .DataValueField("Value")
     
          .DataColorField("Color")
     
          .BindTo((new ACSDoorSignage.BIZ.LabelTypeBiz()).GetAllLabelTypesAsRazorArray(false));
     
      
          resource.Add(m => m.LabelID)
     
          .DataTextField("Text")
     
          .DataValueField("Value")       
     
          .BindTo((new ACSDoorSignage.BIZ.LabelBiz()).GetLabelsAsRazorArray(false));
            
      })

    This is the filter that I try to use, where labelValue is one of the value returned in the binding (eg 1)

    if (labelValue != -1) {
     
              var filter = {
     
                  logic: "or",
     
                  filters: new Array()
     
              };
     
              filter.filters.push(
     
               {
                  operator: "eq",
     
                  field: "LabelID",
     
                  value: labelValue
     
              });
          }
     
          var scheduler = $("#scheduler").data("kendoScheduler");
     
          scheduler.dataSource.filter(filter);

     

    The filter Always fails and I see on the browser:

    Uncaught TypeError: (d.LabelID || "").toLowerCase is not a function

    Can you help me to unserstand what happened?

    If I'd like to apply a filter, MUST I Always define a resource for that filter?

     

  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 26 Nov 2015 Link to this post

    Hi Luca,

    From the provided information it's not clear for us what exactly you are trying to achieve:
    • Filter the Resource DataSource on editing
    • Filter the Scheduler DataSource

    Could you please elaborate more on this? This would help us get better overview of the exact setup that you have and advice you better how to proceed. 

    Regards,
    Vladimir Iliev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Luca
    Luca avatar
    7 posts
    Member since:
    Nov 2015

    Posted 26 Nov 2015 in reply to Vladimir Iliev Link to this post

    I solved via ticket support...I'm sorry!
Back to Top