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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filter Localization in a GGC

Thread ID:

Created:

Updated:

Platform:

Replies:

25998 Mar 11,2005 09:48 AM UTC Sep 7,2005 08:44 PM UTC WinForms 8
loading
Tags: GridControl
Jose Egea
Asked On March 11, 2005 09:48 AM UTC

Hello: I would like to translate all the messages like "equals", "begins with" to Spanish in the filter of a GridGroupingControl. I have seen a sample for DataBoundGrid, but it doesn''t work in a GGC. Is it posible? Regards

Administrator [Syncfusion]
Replied On March 11, 2005 06:21 PM UTC

Currently, there is no hooks to easily localize the FilterBar in a GridgroupingCOntrol. To display your own dialog will require deriving the cell control. I will try to post a sample sometime Monday.

Administrator [Syncfusion]
Replied On March 12, 2005 08:58 PM UTC

Here is a sample showing how you can derive a cell ceontrol and display your own dialog. http://www.syncfusion.com/Support/user/uploads/GGC_FilterBar_Dlg_203aa553.zip

Jose Egea
Replied On March 14, 2005 10:03 AM UTC

Great. How can I avoid showing none, custom and empty options in this sample, as you can do in the databoundgrid? Best regards

Administrator [Syncfusion]
Replied On March 14, 2005 10:07 AM UTC

I would like to hide the empty option because there is no string to translate it. Is that this way?

Administrator [Syncfusion]
Replied On March 14, 2005 11:07 AM UTC

If you want to provide your own empty string, then you can set this property: CustomFilterBarCellModel model = this.gridGroupingControl1.TableModel.CellModels["CustFilterBarCell"] as CustomFilterBarCellModel; model.SelectEmptyText = "SomeEmptyText"; Similarly, model.SelectAllText and model.SelectCustomText will let you control the text that appears for these options as well. If you want to omit them entirely, then one way would be to add this override to teh custom cell model. Then if you set any of teh properties mentioned above to be teh empty string, then that empty option will not appear in teh drop list.
//these members used in renderer''s ListBoxMouseUp
internal int offset = 0;
internal int customOption = 1;
internal int allOption = 0;
public override void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive)
{
	base.FillWithChoices (listBox, style, out exclusive);
	this.offset = 0;
	this.customOption = 1;
	if(this.SelectAllText.Length == 0)
	{
		listBox.Items.RemoveAt(0);
		this.offset += 1;
		this.customOption -= 1;
		this.allOption = -1;
	}
	if(this.SelectCustomText.Length == 0)
	{
		this.customOption = -1;
		listBox.Items.RemoveAt(1 - offset);
		this.offset += 1;
	}
	if(this.SelectEmptyText.Length == 0)
	{
		listBox.Items.RemoveAt(2 - offset);
		this.offset += 1;
	}
}
If you remove any of the options, then things have to be adjusted in the renderer''s ListBoxMouseUp override using the values saved in the cellmodel.
protected override void ListBoxMouseUp(object sender, MouseEventArgs e)
{
	GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo) StyleInfo;
	GridTableCellStyleInfoIdentity tableCellIdentity = tableStyleInfo.TableCellIdentity;
	if( this.ListBoxPart.SelectedIndex == filterModel.customOption)
	{
		MyFilterBarCustomDlg dlg = new MyFilterBarCustomDlg();
		dlg.colLabel.Text = tableCellIdentity.Column.MappingName;
		dlg.SetStrings(filterModel.FilterBarStrings);
		if(dlg.ShowDialog() == DialogResult.OK)
		{
			//apply the filter
			tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(dlg.FilterString);
		}
	}
	else
	{
		if( this.ListBoxPart.SelectedIndex == filterModel.allOption)
			tableCellIdentity.Table.TableDescriptor.RecordFilters.Clear();

		int index = this.ListBoxPart.SelectedIndex;
		if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset)
			index += filterModel.offset;
		CurrentCell.CloseDropDown(PopupCloseType.Done);
		Model.Select(tableCellIdentity, index);
		SetTextBoxText(GetFilterBarText(StyleInfo), false);
	}
}

Ronnie Lu
Replied On August 25, 2005 07:15 PM UTC

Hi, Clay: I try to blank out the "Custom" option from the filter dropdownlist, but found one bug. The original RecordFilterDescriptor Collection Editor Panel will pop up against whatever at selected index 1, the just blocked "Custom" position. I guess something in the Model also need changed. Best wishes. Ronnie Lu >If you want to provide your own empty string, then you can set this property: > > >CustomFilterBarCellModel model = this.gridGroupingControl1.TableModel.CellModels["CustFilterBarCell"] as CustomFilterBarCellModel; >model.SelectEmptyText = "SomeEmptyText"; > > >Similarly, model.SelectAllText and model.SelectCustomText will let you control the text that appears for these options as well. > >If you want to omit them entirely, then one way would be to add this override to teh custom cell model. Then if you set any of teh properties mentioned above to be teh empty string, then that empty option will not appear in teh drop list. >
>//these members used in renderer''s ListBoxMouseUp
>internal int offset = 0;
>internal int customOption = 1;
>internal int allOption = 0;
>public override void FillWithChoices(ListBox listBox, GridStyleInfo style, out bool exclusive)
>{
>	base.FillWithChoices (listBox, style, out exclusive);
>	this.offset = 0;
>	this.customOption = 1;
>	if(this.SelectAllText.Length == 0)
>	{
>		listBox.Items.RemoveAt(0);
>		this.offset += 1;
>		this.customOption -= 1;
>		this.allOption = -1;
>	}
>	if(this.SelectCustomText.Length == 0)
>	{
>		this.customOption = -1;
>		listBox.Items.RemoveAt(1 - offset);
>		this.offset += 1;
>	}
>	if(this.SelectEmptyText.Length == 0)
>	{
>		listBox.Items.RemoveAt(2 - offset);
>		this.offset += 1;
>	}
>}
>
>If you remove any of the options, then things have to be adjusted in the renderer''s ListBoxMouseUp override using the values saved in the cellmodel. > >
>protected override void ListBoxMouseUp(object sender, MouseEventArgs e)
>{
>	GridTableCellStyleInfo tableStyleInfo = (GridTableCellStyleInfo) StyleInfo;
>	GridTableCellStyleInfoIdentity tableCellIdentity = tableStyleInfo.TableCellIdentity;
>	if( this.ListBoxPart.SelectedIndex == filterModel.customOption)
>	{
>		MyFilterBarCustomDlg dlg = new MyFilterBarCustomDlg();
>		dlg.colLabel.Text = tableCellIdentity.Column.MappingName;
>		dlg.SetStrings(filterModel.FilterBarStrings);
>		if(dlg.ShowDialog() == DialogResult.OK)
>		{
>			//apply the filter
>			tableCellIdentity.Table.TableDescriptor.RecordFilters.Add(dlg.FilterString);
>		}
>	}
>	else
>	{
>		if( this.ListBoxPart.SelectedIndex == filterModel.allOption)
>			tableCellIdentity.Table.TableDescriptor.RecordFilters.Clear();
>
>		int index = this.ListBoxPart.SelectedIndex;
>		if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset)
>			index += filterModel.offset;
>		CurrentCell.CloseDropDown(PopupCloseType.Done);
>		Model.Select(tableCellIdentity, index);
>		SetTextBoxText(GetFilterBarText(StyleInfo), false);
>	}
>}
>

Administrator [Syncfusion]
Replied On August 25, 2005 07:52 PM UTC

Try changing this line in the ListBoxMouseUp code above. (strict > changed to >=). if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset) to if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex >= filterModel.offset)

Ronnie Lu
Replied On September 7, 2005 08:44 PM UTC

Hi, Clay: This worked well for blanking out the "Custom" option from the filter dropdownlist. However, the code still need some tightening if you want block two or all three "All", "Custom", "Empty" choices from the list. Best wishes. Ronnie Lu >Try changing this line in the ListBoxMouseUp code above. (strict > changed to >=). > >if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex > filterModel.offset) > >to > >if(filterModel.offset > 0 && this.ListBoxPart.SelectedIndex >= filterModel.offset) >

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

;