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.

Large list in grid dropdown cell.

Thread ID:

Created:

Updated:

Platform:

Replies:

51699 Nov 10,2006 10:05 PM Nov 22,2006 12:35 AM Windows Forms 11
loading
Tags: GridControl
Adam K.
Asked On November 10, 2006 10:05 PM

i want to have a grid cell that is an autocomplete dropdown. This issue is that the dropdown has 25000 items so i wanted a virtual approach to this. in addition, i want to bring up a seperate form when i click on the dropdown cell.

any idea how to proceed? example code?

thks,
ak

Adam K.
Replied On November 10, 2006 11:56 PM

i am using the following code below. The dropdown selection is pretty fast but when i move over the cell, it takes a few seconds for the cursor to move on the cell. If you take the
CombboxCells example and change the ChoiceList to 40,000 items then move right and left on that row and you will see that it pauses for a few seconds before it allows you to get on that cell. Any ideas on how to avoid this ?? please let me know .. Code below . .

ArrayList list = new ArrayList();
for (int i = 0; i< 40000; i++)
list.Add(i.ToString());

string[] s1 = (string[]) list.ToArray(typeof (string));

StringCollection s = new StringCollection();
s.AddRange(s1);

gridControl1[rowIndex, 3].CellType = cellType;
gridControl1[rowIndex, 3].ChoiceList = s;
gridControl1[rowIndex, 3].ShowButtons = GridShowButtons.ShowCurrentCellEditing;
gridControl1[rowIndex, 3].DropDownStyle = GridDropDownStyle.AutoComplete;

thks,
ak


>i want to have a grid cell that is an autocomplete dropdown. This issue is that the dropdown has 25000 items so i wanted a virtual approach to this. in addition, i want to bring up a seperate form when i click on the dropdown cell.

any idea how to proceed? example code?

thks,
ak

Administrator [Syncfusion]
Replied On November 13, 2006 04:50 AM

Hi Adam,

Issue 1: Shows the form from grid cell click.

Please refer to the browser sample \In depth\DropDownFormAndUserControlSample shows how you can popup a Form from a grid cell.

The DropDownFormAndUserControl browser sample sample illustrates how to create a custom cell control that places a DropDown Form/UserControl in a cell. The sample actually does it in two ways. It shows you how to display a modal Form using the Form.ShowDialog on a button click within the cell by deriving the GridStaticCellModel / GridStaticCellRenderer. The second way is to derive from the GridDropDownCellModel/ GridDropDownCellRender to drop a UserControl in a manner that handles the focus issues that are involved with pop-ups.The CellControl in both cases displays a CheckedListBox in the dropdown. The CellValue lists the selected options as a comma delimited string. See the Derived Cell Control section in the Grid User’s Guide for more information on custom cell controls.

Issue 2: Loading Large dropdown datasource

you can use the GridListControl celltype to load the large dropdown datasource. Please refer to the attached sample which implements GridListControl cell with large datasource.

Sample : http://www.syncfusion.com/Support/user/uploads/Modified_incidentDrop_9ca3ace0.zip

If this does not explain this issue, can you send us a sample for showing this issue. We will try to debug the issue here.

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 13, 2006 09:48 PM

Haneef,

I am still having some issues here. I want to replicate this functionality below.

1. User can type into a cell and it get autocomplete behavior (again regular dropdown combo type with choicelist has this issue with pause before i move the focus onto the cell so i need to support large)

2. If i can't find it in the dropdown then i want a button in the right of the cell or someway to bring up a multicolumn chooser. this column chooser would allow me to filter any column and it would autofilter that column.

I have attached a screenshot that is from an MFC app that i am trying to mimic. I have also posted this request in my Direct Trac, i kind of need both these behaviors together. I want an autocomplete textbox or dropdown that supports large amounts of data (in my case large string arrays around 40,000) but i also want the feature where i get a button to bring up a form.

Please let me know if you have any further questions or if you can show me some example code to help.

thks,
ak

>Hi Adam,

Issue 1: Shows the form from grid cell click.

Please refer to the browser sample \In depth\DropDownFormAndUserControlSample shows how you can popup a Form from a grid cell.

The DropDownFormAndUserControl browser sample sample illustrates how to create a custom cell control that places a DropDown Form/UserControl in a cell. The sample actually does it in two ways. It shows you how to display a modal Form using the Form.ShowDialog on a button click within the cell by deriving the GridStaticCellModel / GridStaticCellRenderer. The second way is to derive from the GridDropDownCellModel/ GridDropDownCellRender to drop a UserControl in a manner that handles the focus issues that are involved with pop-ups.The CellControl in both cases displays a CheckedListBox in the dropdown. The CellValue lists the selected options as a comma delimited string. See the Derived Cell Control section in the Grid User’s Guide for more information on custom cell controls.

Issue 2: Loading Large dropdown datasource

you can use the GridListControl celltype to load the large dropdown datasource. Please refer to the attached sample which implements GridListControl cell with large datasource.

Sample : http://www.syncfusion.com/Support/user/uploads/Modified_incidentDrop_9ca3ace0.zip

If this does not explain this issue, can you send us a sample for showing this issue. We will try to debug the issue here.

Best Regards,
Haneef

autoCompletePlusButton0.zip

Administrator [Syncfusion]
Replied On November 14, 2006 07:46 AM

Hi Adam,

The attached sample shows you How to put multicolumn chooser in a grid cell by having a custom celltype. It also implements GridListControl for loading the large datasource(datasource is string array). Please try it and let me know if you are looking something different

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/MulticolumnChooserANDDropLargeSc_321d6a95.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 14, 2006 03:11 PM

Haneef

this is close to what i want. the one issue with this is that if you look at the second image in my attachment i actually need a multi column dropdown (which the gridlistcontrol happily supports) but the dropdown needs to have a top row where users can filter by typing in any column and that will filter the resultset. Updated filtering on each keypress would be ideal.

I only was asking for another form on the click event as i figured the gridlistcontrol didn't have this fundamentally built in (and i thought i would have to write my own) but either way would work.

Please let me konw if you have any suggestions.

thks,
ak

>Hi Adam,

The attached sample shows you How to put multicolumn chooser in a grid cell by having a custom celltype. It also implements GridListControl for loading the large datasource(datasource is string array). Please try it and let me know if you are looking something different

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/MulticolumnChooserANDDropLargeSc_321d6a95.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 15, 2006 07:54 AM

Hi Adam,

We will work out for a solution and let you know the details soon. Thanks for being patience.

Best regards,
Haneef

Administrator [Syncfusion]
Replied On November 16, 2006 01:21 AM

Hi Adam,

There is no built-in support for this. But you can do this by derving the GridDropDownGridListControlCellRenderer and place the grid at the top of the gridlistcontrol. Please refer to the attached sample for implementation and let me know if this helps.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/DropdownFilter_17c6f62f.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 18, 2006 09:37 AM

Haneef,

Thanks for your followup. this result in the first column is extremely close to a final solution. the only issue is if i make it s multicolumn chooser (by adding columns to the datatable), i only get the top filter textbox for the first column in the gridlistcontrol. If you look at the image, i want a "top" row that spans all columns and will allow me to filter on 1 or more columns in the gridlistcontrol.

Please let me know if you have any questions. thanks in advance.

thks,
ak

>Hi Adam,

There is no built-in support for this. But you can do this by derving the GridDropDownGridListControlCellRenderer and place the grid at the top of the gridlistcontrol. Please refer to the attached sample for implementation and let me know if this helps.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/DropdownFilter_17c6f62f.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 21, 2006 12:10 AM

Hi Adam,

You need to derive the GridDropDownGridListControlCellRenderer and override the OnShowDrop method to set the colcount/width of the Grid. Please refer to the attached sample for implementation and let me know if this helps.

protected override void OnShowDropDown()
{
base.OnShowDropDown ();

Grid.Size = new Size(this.ListControlPart.Size.Width -20 , 20);

Size ns= new Size(this.ListControlPart.Width, this.ListControlPart.Height - 20);
DataTable dt = this.ListControlPart.DataSource as DataTable;

dt.DefaultView.RowFilter = string.Empty;
Grid.ColCount = dt.Columns.Count ;
this.Grid.ColWidths[0] = 0;
for(int i = 1;i<= Grid.ColCount;i++)
{
this.Grid.Model[1,i].Text = string.Empty;
if( Grid.ColCount == i)
this.Grid.ColWidths[i] = this.ListControlPart.Grid.ColWidths[i] - 2;
else
this.Grid.ColWidths[i] = this.ListControlPart.Grid.ColWidths[i];
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/DropDownFilter_20384fa2.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 21, 2006 08:38 AM

Haneef,

Thanks for the followup. The one issue with your latest example is that each row filter seems to be independent from each other instead of giving a filter across all filtered columns.

For example, if this is my data:

Col1 Col2
Aa1 112
Aa2 113
Bb1 113
Bb2 114

And i filter, "Aa" in the first column and "11" in the second column i only want to see 2 results. Currently you are only filtering off of the current column (not remembering that the old columns were filtered as well)

Please let me know if you have any questions.

thks,
ak

>Hi Adam,

You need to derive the GridDropDownGridListControlCellRenderer and override the OnShowDrop method to set the colcount/width of the Grid. Please refer to the attached sample for implementation and let me know if this helps.

protected override void OnShowDropDown()
{
base.OnShowDropDown ();

Grid.Size = new Size(this.ListControlPart.Size.Width -20 , 20);

Size ns= new Size(this.ListControlPart.Width, this.ListControlPart.Height - 20);
DataTable dt = this.ListControlPart.DataSource as DataTable;

dt.DefaultView.RowFilter = string.Empty;
Grid.ColCount = dt.Columns.Count ;
this.Grid.ColWidths[0] = 0;
for(int i = 1;i<= Grid.ColCount;i++)
{
this.Grid.Model[1,i].Text = string.Empty;
if( Grid.ColCount == i)
this.Grid.ColWidths[i] = this.ListControlPart.Grid.ColWidths[i] - 2;
else
this.Grid.ColWidths[i] = this.ListControlPart.Grid.ColWidths[i];
}
}

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/DropDownFilter_20384fa2.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 22, 2006 12:35 AM

Hi Adam,

You can handle the CurrentCellChanged event and set the rowfilter to the gridlistcontrol. The following code states how to add the rowfilter in a dropdown gridlist control.

private void Grid_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.Grid.CurrentCell;
this.ListControlPart.SelectedIndex = -1;
DataTable dt = this.ListControlPart.DataSource as DataTable;
string sFilterString = string.Empty;
for(int i = 1;i<= Grid.ColCount;i++)
{
if( (this.Grid.Model[1,i].Text != null && this.Grid.Model[1,i].Text != string.Empty )
||( cc.Renderer.ControlText != string.Empty && cc.ColIndex == i))
{
if( cc.ColIndex != i)
{
sFilterString += string.Format("[{0}] LIKE '{1}*'",dt.Columns[i-1],this.Grid.Model[1,i].Text);
}
else
sFilterString += string.Format("{0} LIKe '{1}*'", dt.Columns[cc.ColIndex - 1].ColumnName,cc.Renderer.ControlText);
sFilterString += " AND ";
}
}
sFilterString = sFilterString.Substring(0,sFilterString.Length - 4);
dt.DefaultView.RowFilter = sFilterString;
}

Please refer to the sample for implementation.
http://www.syncfusion.com/Support/user/uploads/DropDownFilter_20384fa2_1e1ef98b.zip

Best Regards,
Haneef

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.

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.

;