Filters

Hello, I'm trying to use and create a scenario with pivot client and need to set some Default Filters (ReadOnly) and i have manage to set filters to a specific Value but i am trying to define filter as something like not in Values.

Is it possible?

This specifies that the data shown will be for VALUE1
<Filters>
     <ej:Field FieldName="[AG_LOCAL].[CANAL].[VALUE1]" />
</Filters>

And what i am trying to get is Not VALUE1 and Not VALUE2 for example and the filter must be fixed without allowing viewer change.

Is there a way to apply the filter server side aspx.cs file?

3 Replies

TM Tamilarasu M Syncfusion Team August 20, 2018 10:19 AM UTC

Hi Hostilio, 

Thanks for contacting Syncfusion support. 

Please find the response below. 

Query 
Response 
Hello, I'm trying to use and create a scenario with pivot client and need to set some Default Filters (ReadOnly) and i have manage to set filters to a specific Value but i am trying to define filter as something like not in Values. 
 
Is it possible? 
 
Sorry for the inconvenience caused. 

We have confirmed that “Filtering members from code behind is not working properly” is an issue and we have logged a defect report. The fix for the issue will be included in our Essential Studio Volume 3 release which is estimated to be available by the mid of September 2018. 
This specifies that the data shown will be for VALUE1 
<Filters> 
     <ej:Field FieldName="[AG_LOCAL].[CANAL].[VALUE1]" /> 
</Filters> 
 
And what i am trying to get is Not VALUE1 and Not VALUE2 for example and the filter must be fixed without allowing viewer change. 
 
Currently, we don’t have support to hide the Member Editor dialog for specific field. But, you can hide the Pivot Buttons in the “renderComplete” event as a work around solution. This will prevent the Pivot Buttons from click event. Please refer the code snippet below. 

Cod Snippet: [aspx] 
</DataSource> 
      <ClientSideEvents RenderComplete="hidePivotButtons" /> 
//…. 
 
 
<script> 
function hidePivotButtons() { 
for( var i=0;i<$(".e-schemaFilter .e-pivotButton").length; i++){ 
if ($(".e-schemaFilter .e-pivotButton:eq(" + i + ")").attr("data-tag") == "filters:[Date].[Fiscal]") 
   $(".e-schemaFilter .e-pivotButton:eq(" + i + ")").hide(); 
  }               
}        
</script> 
 
 
 
Is there a way to apply the filter server side aspx.cs file? 

You can apply filter from aspx.cs page by following the below code snippet. 

Code Snippet: [C#] 
 
protected void Page_Load(object sender, EventArgs e) 
{ 
Field fieldElement = new Field(); 
fieldElement.FieldName = "[Date].[Fiscal]"; 
this.PivotClient1.Model.DataSource.Filters.Add(fieldElement); 
} 
 
 


Meanwhile, we have prepared a sample for your convenience. Please find the sample in the below link. 



Regards, 
Tamilarasu M 



HO Hostilio August 20, 2018 02:39 PM UTC

On this scenario the Field is Date.Fiscal and i need to pre filter it with Fiscal != '20180101' and Fiscal != '20180201', is it possible?

protected void Page_Load(object sender, EventArgs e) 
{ 
Field fieldElement = new Field(); 
fieldElement.FieldName = "[Date].[Fiscal]"; 
this.PivotClient1.Model.DataSource.Filters.Add(fieldElement); 
}



TM Tamilarasu M Syncfusion Team August 21, 2018 10:05 AM UTC

Hi Hostilio,    
    
Currently, our architecture supports only include filter type alone. Members that are added in filter items alone will be displayed in PivotGrid and PivotChart.   
Also, as we mentioned in our earlier update, we are facing issue while adding filter items through code behind and the fix for this issue will be available in our upcoming volume 3 Essential studio release which is estimated to be available in the Month of September.    
    
Regards,   
Tamilarasu M   


Loader.
Up arrow icon