Hi Junior,
Thanks for contacting Syncfusion Support.
You can send the filter values to the WebAPI controller through “doAjaxPost” method. For that, you need to create additional controller method. In the btnClick() event, you need to get date picker value and set it to the variable and you can pass it through “doAjaxPost” method to the WebAPI controller. In the “doAjaxPost”, you need to specify controller method name. Please refer below code snippet.
Code Snippet: [javascript]
|
function btnClick(args) {
var data = '{ startDate : "4/9/2017" , endDate : "17/9/2017" }'; // Get value from date picker and set it to the variable
var pivotClientObj = $('#PivotClient1').data("ejPivotClient");
var serializedCustomObject = JSON.stringify(pivotClientObj.model.customObject);
pivotClientObj.doAjaxPost("POST", pivotClientObj.model.url + "/" + "filterDate", JSON.stringify({
"action": "initializeClient", "data": data, "customObject": serializedCustomObject, "clientParams": pivotClientObj.model.enableMeasureGroups + "-" + pivotClientObj.model.chartType + "-" + pivotClientObj.model.enableKPI
}), pivotClientObj._renderControlSuccess);
} |
You can access the data in the WebAPI controller method as like in the below screenshot.
In the method, you need to filter the data using filter parameters and pass it to the GetJsonData method.
|
[System.Web.Http.ActionName("filterDate")]
[System.Web.Http.HttpPost]
public Dictionary<string, object> filterDate(Dictionary<string, object> jsonResult)
{
return pivotClient.GetJsonData("initializeClient", ProductSales.GetSalesData(), null);
//Here you need to pass your filtered datasource
} |
Meanwhile, we have prepared sample as per your requirement. Please find the sample in below link.
Thanks,
Manikandan.