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

GridFilterBar error

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

11 Replies

AD Administrator Syncfusion Team April 8, 2004 12:05 AM UTC

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.


JL Jose Luis Melo April 12, 2004 11:54 AM UTC

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


AD Administrator Syncfusion Team April 12, 2004 12:12 PM UTC

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?


JL Jose Luis Melo April 12, 2004 12:28 PM UTC

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?


JL Jose Luis Melo April 13, 2004 01:25 PM UTC

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


AD Administrator Syncfusion Team April 13, 2004 03:54 PM UTC

"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''.


JL Jose Luis Melo April 13, 2004 05:13 PM UTC

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


JL Jose Luis Melo April 13, 2004 05:19 PM UTC

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


JL Jose Luis Melo April 13, 2004 05:22 PM UTC

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)


AD Administrator Syncfusion Team April 13, 2004 05:28 PM UTC

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


JL Jose Luis Melo April 14, 2004 07:07 AM UTC

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

Loader.
Up arrow icon