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.

GridFilterBar error

Thread ID:

Created:

Updated:

Platform:

Replies:

12677 Apr 7,2004 07:37 AM Apr 14,2004 03:07 AM Windows Forms 11
loading
Tags: GridControl
Jose Luis Melo
Asked On April 7, 2004 07:37 AM

Hi, I have a GridFilterBar inside a GridDataBoundGrid. If I select a value from the GridFilterBar combos, the affected rows are shown. Then I update the grid''s DataSource with the same datatable, but with new rows. I save the RowFilter string and then put it again, so I can keep the selected information. Then if I select "none" from the GridFilterBar combos, the new rows are missing !!! But their values are inside the GridFilterBar combos, so I can filter them, and If I select one of those rows, the row is shown. But If I select "none", the rows are not shown !!! Do you have any idea why this happens, or to solve the problem ??? (using 1.6.1.8) Thanks for your time, Jose Melo

Administrator [Syncfusion]
Replied On April 7, 2004 08:05 PM

After adding your new rows to the DataTable, are you calling DataTable.AcceptChanges? If not, you might try calling AcceptChanges on your Datatable to see if that avoids this probloem.

Jose Luis Melo
Replied On April 12, 2004 07:54 AM

The AcceptChanges() didn''t solve the problem. I made some experiences and realised that the rows realy are inside the DataTable, so there is no problem with the data being or not in the DataTable (i think). The problem is that: the ''none'' option is selected, but it seems it is not being executed (this only happens when ''none'' is the first option I select, after the grid being refreshed). By the way, when I select ''none'' the DataSet.Tables(1).DefaultView.RowFilter value is not changed, and the value that was selected (filtered), keeps being filtered. If I select other value, the filter works perfectly. And then the ''none'' option work ok again. Is there any action I might be executing that deletes the ''none'' action ? Thanks again, Jose Melo

Administrator [Syncfusion]
Replied On April 12, 2004 08:12 AM

When you are resetting the filter when the selection is "none", if you explicitly set DataSet.Tables(1).DefaultView.RowFilter = "" does this make things work?

Jose Luis Melo
Replied On April 12, 2004 08:28 AM

Yes, perfectly... >When you are resetting the filter when the selection is "none", if you explicitly set > >DataSet.Tables(1).DefaultView.RowFilter = "" > > >does this make things work?

Jose Luis Melo
Replied On April 13, 2004 09:25 AM

explicity means that I insert a break point in the grid''s click event and execute the RowFilter="". This action reset the grid''s filter. But the problem continue happening. Or there is any event I can execute this line (RowFilter="") ? Thanks, Jose Melo

Administrator [Syncfusion]
Replied On April 13, 2004 11:54 AM

"I save the RowFilter string and then put it again," Where you are currently ''putting it again'', first set DataSet.Tables(1).DefaultView.RowFilter = "", and then ''put it again''.

Jose Luis Melo
Replied On April 13, 2004 01:13 PM

Dim index as integer = grid.CurrentCell.RowIndex '' record the filter to a string Dim strFilter as string = dataset.Tables(1).DefaultView.RowFilter() Dim strSort as string = dataset.Tables(1).DefaultView.Sort() UpdateTable (1) '' function that updates table in the dataset grid.BeginUpdate grid.GridBoundColumns.Clear() If Not (theFilterBar Is Nothing) And (theFilterBar.Wired) Then theFilterBar.RowFilter = "" theFilterBar.UnwireGrid() End If grid.DataSource = dataset.Tables(1) grid.Refresh() grid.EndUpdate() '' here is the putting it again dataset.Tables(1).DefaultView.RowFilter() = strFilter dataset.Tables(1).DefaultView.Sort() = strSort grid.ForceCurrentCellMoveTo = True grid.CurrentCell.MoveTo(index, 2) That''s it... after running this code, the ''none'' option from the FilterBar doesn''t work. Jose Melo

Jose Luis Melo
Replied On April 13, 2004 01:19 PM

ups, I forgot... I''m wireing the FilterBar (and removing the custom option), just before the grid.Refresh with: theFilterBar.WireGrid(grid) For col As Integer = 0 To grid.Model.ColCount Dim dt As DataTable = New DataTable dt = grdPorAlocar2(1, col).DataSource() If Not (IsNothing(dt)) Then dt.Rows.RemoveAt(1) End If Next Jose Melo

Jose Luis Melo
Replied On April 13, 2004 01:22 PM

Sorry the mistakes before, here is the whole code... Dim index as integer = grid.CurrentCell.RowIndex '''' record the filter to a string Dim strFilter as string = dataset.Tables(1).DefaultView.RowFilter() Dim strSort as string = dataset.Tables(1).DefaultView.Sort() UpdateTable (1) '''' function that updates table in the dataset grid.BeginUpdate grid.GridBoundColumns.Clear() If Not (theFilterBar Is Nothing) And (theFilterBar.Wired) Then theFilterBar.RowFilter = "" theFilterBar.UnwireGrid() End If grid.DataSource = dataset.Tables(1) theFilterBar.WireGrid(grid) For col As Integer = 0 To grid.Model.ColCount Dim dt As DataTable = New DataTable dt = grid(1, col).DataSource() If Not (IsNothing(dt)) Then dt.Rows.RemoveAt(1) End If Next grid.Refresh() grid.EndUpdate() '''' here is the putting it again dataset.Tables(1).DefaultView.RowFilter() = strFilter dataset.Tables(1).DefaultView.Sort() = strSort grid.ForceCurrentCellMoveTo = True grid.CurrentCell.MoveTo(index, 2)

Administrator [Syncfusion]
Replied On April 13, 2004 01:28 PM

You are setting theFilterBar.RowFilter = "" How about saving this value and also reset it after you rewire the grid and reset the RowFilter.

Jose Luis Melo
Replied On April 14, 2004 03:07 AM

Yes, it solved the problem... I was only loading the dataset RowFilter and not the FilterBar RowFilter. I thought the dataset RowFilter, after the Bar being wired, would copy its value to the FilterBar... anyway, my fault, i never saw it''s value, and check it. Thanks a lot for your time once again, Jose Melo

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.

;