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.
Syncfusion Feedback

Change Excel-Filter from true/false in German Ja/Nein

Thread ID:

Created:

Updated:

Platform:

Replies:

131504 Jul 13,2017 01:36 PM UTC Jul 18,2017 04:23 PM UTC Windows Forms 5
loading
Tags: GridGroupingControl
Thomas
Asked On July 13, 2017 01:40 PM UTC

Hello,I have a table with a column (bool) true/false and I replace this in the column with Ja/Nein (German). Now I would like to replace the same when I open the Dialogbox in the Excelfilter. Is this possible?And I have enabled the EnableDateFilter = true and EnableNumberFiler = true. I have translated the Excel-Filter in German but I don't find a possibility to traanslate the Number Filter and Date Filter incl. Submenu.Thanks for your supportBR Thomas

Arulpriya Ramalingam [Syncfusion]
Replied On July 14, 2017 12:51 PM UTC

Hi Thomas,   
  
Thanks for using Syncfusion products.   
  
Query   
Response   
Now I would like to replace the same when I open the Dialogbox in the Excelfilter. Is this possible?   
The CheckedListBoxPart items are added from the cellvalue of each records for the column.  In order to replace the ExcelFilter values for Boolean column, the CheckBoxOptions property of GridCheckBoxCellInfo class can be used. Please make use of below code and sample,   
  
//To set the filter dialog list values   
this.gridGroupingControl1.TableDescriptor.Columns["CheckBox"].Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo("ja""nein"""false);   
And I have enabled the EnableDateFilter = true and EnableNumberFiler = true. I have translated the Excel-Filter in German but I don't find a possibility to trasnslate the Number Filter and Date Filter incl.   
A class can be inherited from ILocalizationProvider class to set a localized string for default ExcelFilter items. Please refer to the below code example and sample,   
  
//In Localizer.cs   
public string GetLocalizedString(System.Globalization.CultureInfo culture, string name, object obj)   
{   
    switch (name)   
    {   
        case "DateTimeFilters":   
            return "Terminzeit filter";   
        case "NumberFilters":   
            return "nummer filter";   
        case "Office2007FilterDateEquals":   
            return "Text for equal";   
        case "Office2007Filterbefore":   
            return "Text for before";   
///For all filter items   
     }   
}    
  
//In Form.cs   
#region Localization   
Localizer loc = new Localizer();   
LocalizationProvider.Provider = loc;   
#endregion   
   
  
Dashboard sample: <Install Location>\Syncfusion\EssentialStudio\<ProductVersion>\Windows\Grid.Grouping.Windows\Samples\Localization Samples\Localization Demo\CS   
   
  
Regards,   
Arulpriya   


Thomas
Replied On July 15, 2017 07:01 AM UTC

Hello,thanks for your fast response. I upload a picture with the content i would like to change.I would like true / false change in Ja / Nein.BR ThomasAttachment: 20170715_08_41_43Program_Manager_6644bfd0.zip

Arulpriya Ramalingam [Syncfusion]
Replied On July 17, 2017 08:35 AM UTC

Hi Thomas,   
  
Thanks for your update.   
  
We could understand your scenario. The GridGroupingControl does not have direct support to change the filter dialog values. This can be achieved by creating CustomCheckBoxCellModel and CustomCheckBoxCellRenderer. In CustomCheckBoxCellRenderer the DrawCheckBox() method can be overridden to change the CellValue of boolean column. Please make use of below code example and sample,   
  
Code example:  
   
protected override void DrawCheckBox(Graphics g, Rectangle clientBounds, GridStyleInfostyle, ButtonState state, ContentAlignment align, string text, Font font)   
{   
    GridTableCellStyleInfo cellStyle = style as GridTableCellStyleInfo;   
    if (cellStyle != null && cellStyle.TableCellIdentity != null && cellStyle.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)   
    {   
        string cellValue = style.CellValue.ToString();   
        if (cellValue == "True")   
            g.DrawString("Ja", style.GdipFont, new SolidBrush(style.TextColor), clientBounds);   
        if (cellValue == "False")   
            g.DrawString("Nein", style.GdipFont, new SolidBrush(style.TextColor), clientBounds);   
    }   
}   
   
  
Regards,   
Arulpriya   


Thomas
Replied On July 17, 2017 01:22 PM UTC

Hello,

I have tried your example. But I think it is not working. See my attachment.

BR Thomas


Attachment: 20170717_15_06_11BackColor_5b1a0edb.zip

Arulpriya Ramalingam [Syncfusion]
Replied On July 18, 2017 04:23 PM UTC

Hi Thomas, 

Thanks for your update. 

As per our GridGroupingControl architecture, the FilterBarDropDown items are added from data source value. The GridGroupingControl does not have direct support to change the filter drop down items. The reported scenario can be achieved by adding the drop down items manually using TableControlCurrentCellShowingDropDown and DrawCellDisplayText events. In TableControlCurrentCellShowingDropDown event, the Items property of ListBoxPart can be used to add the drop down items to current cell renderer and in DrawCellDisplayText event, DisplayText property can be used to set the SelectedItem in FilterBarCell. Please make use of below code and sample, 
 
Code snippet   
 
//Event Triggerring 
this.gridGroupingControl1.TableControlCurrentCellShowingDropDown += GridGroupingControl1_TableControlCurrentCellShowingDropDown; 
 
GridTableFilterBarCellRenderer renderer; 
//Event Customization 
private void GridGroupingControl1_TableControlCurrentCellShowingDropDown(object sender, GridTableControlCurrentCellShowingDropDownEventArgs e) 
{ 
    renderer = e.TableControl.CurrentCell.Renderer as GridTableFilterBarCellRenderer; 
    if (renderer.ListBoxPart.Items.Contains("True")) 
    { 
        int index = renderer.ListBoxPart.Items.IndexOf("True"); 
        renderer.ListBoxPart.Items[index] = "Ja"; 
    } 
    if (renderer.ListBoxPart.Items.Contains("False")) 
    { 
        int index = renderer.ListBoxPart.Items.IndexOf("False"); 
        renderer.ListBoxPart.Items[index] = "Nein"; 
    } 
} 
 
//Event Triggerring 
this.gridGroupingControl1.TableControl.DrawCellDisplayText += TableControl_DrawCellDisplayText; 
 
//Event Customization 
private void TableControl_DrawCellDisplayText(object sender, GridDrawCellDisplayTextEventArgs e) 
{ 
    if (e.Style.CellType == "FilterBarCell" && e.Style.CellIdentity.ColIndex == 5) 
    { 
        if (e.DisplayText == "True") 
            e.DisplayText = "Ja"; 
        else if (e.DisplayText == "False") 
            e.DisplayText = "Nein"; 
 
    } 
} 
 
 
Regards, 
Arulpriya 


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.

Warning Icon 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.Close Icon

;