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. Image for the cookie policy date

Filter Localization in a GGC

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

8 Replies

AD Administrator Syncfusion Team 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.


AD Administrator Syncfusion Team 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


JE Jose Egea 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


AD Administrator Syncfusion Team 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?


AD Administrator Syncfusion Team 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);
	}
}


RL Ronnie Lu 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);
>	}
>}
>


AD Administrator Syncfusion Team 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)


RL Ronnie Lu 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) >

Loader.
Live Chat Icon For mobile
Up arrow icon