- Home
- Forum
- ASP.NET MVC
- Filter the resources
Filter the resources
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.
SIGN IN To post a reply.
3 Replies
KK
Karthigeyan Krishnamurthi
Syncfusion Team
March 1, 2017 11:10 AM UTC
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
CA
Cornel Amarandei
March 1, 2017 01:35 PM UTC
Thanks, it works (with what I've done and some ideea from your sample:) ).
Cornel.
KK
Karthigeyan Krishnamurthi
Syncfusion Team
March 2, 2017 04:01 AM UTC
Hi Cornel,
We are happy that our solution has fulfilled your requirement.
Please let us know if you need further assistance.
Regards,
Karthigeyan
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
CA Cornel Amarandei
- Feb 28, 2017 03:48 PM UTC
- Mar 2, 2017 04:01 AM UTC