We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Filter the resources

Thread ID:

Created:

Updated:

Platform:

Replies:

129127 Feb 28,2017 10:48 AM Mar 1,2017 11:01 PM ASP.NET MVC 3
loading
Tags: Schedule
Cornel Amarandei
Asked On February 28, 2017 10:48 AM

Hi,

I want to filter on the client the resources of a Schedule("TeamSchedule"), based on what I write on a TextBox("FilterTextBox").

What I've done so far is this:

function onFilterClick() {
        var schObj = $("#TeamSchedule").data("ejSchedule");        
        schObj.model.resources[0].resourceSettings.dataSource = ej.DataManager(schObj.model.resources[0].resourceSettings.dataSource).executeLocal(ej.Query().where("text", ej.FilterOperators.contains, $("#FilterTextBox").val()));
        schObj.refresh();
}

This is working, but the problem is that after I first filter by a resource, I cannot go back to all the resources, they are lost. So in this way if I want to filter again for a different resource, the filter will be search on the result of the first filter and not in the all resources.

Thanks,
Cornel.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On March 1, 2017 06:10 AM

Hi Cornel,   
   
Thank you for contacting Syncfusion support.   
   
In the provided code example, resource data source is altered with the filtered object, therefore initial data source will not maintain. We have prepared the sample to render the resource based on the user selection which can be viewed from the below location.   
 
Kinldy refer the below code example used in the sample. 
 
<Code> 
function onCreate(args) { // this function will be during the initial load 
            resData = $.extend(true, [], this.model.resources[0].resourceSettings.dataSource); 
        } 
function onChange(args) { // this function will be called when the radio button is clicked 
            var resourceObject = ej.DataManager(resData).executeLocal(ej.Query().where("text", ej.FilterOperators.equal, args.model.text)); // here we will filter particular resource that is clicked 
            $("#Schedule1").ejSchedule({ 
                group: { 
                    resources: ["Owners"] 
                }, 
                resources: [{ 
                    field: "ownerId", 
                    title: "Owner", 
                    name: "Owners", allowMultiple: true, 
                    resourceSettings: { 
                        dataSource: $.extend(true, [], resourceObject), 
                        text: "text", id: "id", groupId: "groupId", color: "color" 
                    } 
                }] 
            }); 
        } 
</Code>  
 
Regards, 
Karthigeyan 


Cornel Amarandei
Replied On March 1, 2017 08:35 AM

Thanks, it works (with what I've done and some ideea from your sample:) ).

Cornel.

Karthigeyan Krishnamurthi [Syncfusion]
Replied On March 1, 2017 11:01 PM

Hi Cornel 
 
We are happy that our solution has fulfilled your requirement. 
 
Please let us know if you need further assistance. 
 
Regards, 
Karthigeyan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;