Quantcast
Channel: Advanced DataGridView with Excel-like auto filter
Viewing all 198 articles
Browse latest View live

Reviewed: 0.1.0.10 (Jul 11, 2014)

$
0
0
Rated 5 Stars (out of 5) - This code is awesome! I searched for hours on Google looking for something like this, I'd almost given up then found this a number of pages into the search. This should be the number 1 hit. There are a few very minor issues, which you'd expect given the version maturity, but still giving 5 stars thanks to my relief at finding this.

New Post: Localization

$
0
0
A real awesome job, thanks for your sharing

Updated Wiki: Home

$
0
0

NUGET

http://www.nuget.org/packages/ADGV/

EN

It`s a Windows Forms DataGridView Control with Excel-Like auto-filter context menu. Support Localization (currently RU, EN, FR)


RU

Windows Forms DataGridView контрол с Excel-подобным авто-фильтром в виде контекстного меню в заголовках столбцов

Работая над своим проектом, я так и не смог найти подходящий контрол для отображения табличных данных с поддержкой фильтрации и сортировки. В результате на основе ContextMenuStrip был реализован авто-фильтр "как в Excel".

adgv

Особенности:

  • Поддержка типов данных: All Numeric, DateTime, Boolean, все остальные типы интерпретируются как String
  • Сортировка
  • Пользовательский фильтр
  • Фильтр на основе выбранных значений из элемента TreeView

В комплекте с фильтром идет DataGridView, который автоматически добавляет авто-фильтр к своим столбцам и обрабатывает события фильтрации. Единственное, что требуется для работы  - это добавить BindingSource и обработать события FilterStringChanged и SortStringChanged.

Выкладываю исходный код и готовую библиотеку dll "as is". Если кто-то найдет и исправит ошибки или предложит более удачные решения буду благодарен. К сожалению времени на дальнейшую разработку нет и пока не ожидается.

Пользуйтесь как есть. Пожалуйста :)


P.S.: PayPal Donate

Created Unassigned: Boolean filter not work with true and false selected [1492]

$
0
0
When you select true and false, it will only show the false part

Commented Unassigned: Boolean filter not work with true and false selected [1492]

$
0
0
When you select true and false, it will only show the false part
Comments: ** Comment from web user: Zubyme **

funny bug
Do you have a "empty" field to select in filter?

Commented Unassigned: Boolean filter not work with true and false selected [1492]

$
0
0
When you select true and false, it will only show the false part
Comments: ** Comment from web user: Zubyme **

Try to change in
private String CreateFilterString(IEnumerable<TripleTreeNode> nodes)
line "else if (this.DataType == typeof(Boolean))"
to line "else if (this.DataType == typeof(Boolean) && nodes.Count() == 1)"

Commented Unassigned: Boolean filter not work with true and false selected [1492]

$
0
0
When you select true and false, it will only show the false part
Comments: ** Comment from web user: Zubyme **

*Try to change in ADGVFilterMenu class

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

I've got this, Displays the grid, but will not filter anything. Perhaps someone will show us what's wrong.
Thanks for the helps and code.

```
Option Strict On

Public Class Form1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim table As New DataTable

' Create four typed columns in the DataTable.
table = DataSet1.Tables.Add("Reference")
table.Columns.Add("Dosage", GetType(Integer))
table.Columns.Add("Drug", GetType(String))
table.Columns.Add("Patient", GetType(String))
table.Columns.Add("Date", GetType(DateTime))
' Add five rows
table.Rows.Add(25, "Indocin", "David", DateTime.Today.AddDays(-40))
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Today.AddDays(-20))
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now)

'initialize bindingsource
BindingSource_main.DataMember = table.TableName
BindingSource_main.DataSource = DataSet1
'initialize datagridview
With AdvancedDataGridView_Main
.DataSource = BindingSource_main
.DisableFilterAndSort(AdvancedDataGridView_Main.Columns("Dosage"))
.SetFilterDateAndTimeEnabled(AdvancedDataGridView_Main.Columns("Date"), True)
.SetSortEnabled(AdvancedDataGridView_Main.Columns("Patient"), False)
.SortDESC(AdvancedDataGridView_Main.Columns("Drug"))
End With
InitializeComponent()
End Sub

End Class
```


Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

Forgot the resulting image :(

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: Zubyme **

Do you implement this methods?

private void dataGridView_FilterStringChanged(object sender, EventArgs e)
{
<YouDataSource>.Filter = this.dataGridView.FilterString;
}

private void dataGridView_SortStringChanged(object sender, EventArgs e)
{
<YouDataSource>.Sort = this.dataGridView.SortString;
}

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

After doing what Zubyme suggested and tweaking here and there, it finally worked in vb.net 2013. In the following days I will send you a step by step guide of what I did exactly so that everyone else who is interested can take advantage and you can add it to your documentation section if you like.

```
Option Strict On

Public Class Form1

' When the form initially loads
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim table As New DataTable
' Create four typed columns in the DataTable.
table = DataSet1.Tables.Add("Reference")
table.Columns.Add("Dosage", GetType(Integer))
table.Columns.Add("Drug", GetType(String))
table.Columns.Add("Patient", GetType(String))
table.Columns.Add("Date", GetType(DateTime))
' Add five rows
table.Rows.Add(25, "Indocin", "David", DateTime.Today.AddDays(-40))
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Today.AddDays(-20))
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now)

'initialize bindingsource
BindingSource_main.DataMember = table.TableName
BindingSource_main.DataSource = DataSet1
'initialize datagridview
With AdvancedDataGridView_Main
.DataSource = BindingSource_main
.DisableFilterAndSort(AdvancedDataGridView_Main.Columns("Dosage"))
.SetFilterDateAndTimeEnabled(AdvancedDataGridView_Main.Columns("Date"), True)
.SetSortEnabled(AdvancedDataGridView_Main.Columns("Patient"), False)
.SortDESC(AdvancedDataGridView_Main.Columns("Drug"))
End With
'InitializeComponent() ' is not needed and if used will not work

End Sub

' Change Filter string when user selects one from the drop box
Private Sub AdvancedDataGridView_Main_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView_Main.FilterStringChanged
BindingSource_main.Filter = Me.AdvancedDataGridView_Main.FilterString
End Sub

' Chnage sort string when user selects (or clears) one from the drop box
Private Sub AdvancedDataGridView_Main_SortStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView_Main.SortStringChanged
BindingSource_main.Sort = Me.AdvancedDataGridView_Main.SortString
End Sub

End Class

```

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: Zubyme **

Thanx!
Also you can send me source code i will upload it as apatch

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: Zubyme **

Thanx!
Also you can send me source code i will upload it as apatch

Commented Unassigned: Completa Auto Filter [1437]

$
0
0
Hello. Very interesting project. I wonder if in the future would be planned for the project by completing the menu as in excel 2013 including filter and order by color, search textbox and submenus with default filters depending on the data type. Or is hard work and is not expected
thank you very much
Comments: ** Comment from web user: Zubyme **

It`s not very hard but need many time. By now i don`t have it.

...and maybe winforms is a dead and we all need wpf components

Closed Unassigned: Completa Auto Filter [1437]

$
0
0
Hello. Very interesting project. I wonder if in the future would be planned for the project by completing the menu as in excel 2013 including filter and order by color, search textbox and submenus with default filters depending on the data type. Or is hard work and is not expected
thank you very much

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

The full code follows:

```
Option Strict On

Public Class Form1

' When the form initially loads
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

Dim table As New DataTable
' Create four typed columns in the DataTable.
table = DataSet_Main.Tables.Add("Reference")
table.Columns.Add("Dosage", GetType(Integer))
table.Columns.Add("Drug", GetType(String))
table.Columns.Add("Patient", GetType(String))
table.Columns.Add("Date", GetType(DateTime))
' Add five rows
table.Rows.Add(25, "Indocin", "David", DateTime.Today.AddDays(-40))
table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now)
table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Today.AddDays(-20))
table.Rows.Add(21, "Combivent", "Janet", DateTime.Now)
table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now)

'initialize bindingsource (defined as control on the form)
BindingSource_main.DataMember = table.TableName
BindingSource_main.DataSource = DataSet_Main
'initialize datagridview
With AdvancedDataGridView_Main
.DataSource = BindingSource_main
.DisableFilterAndSort(AdvancedDataGridView_Main.Columns("Dosage"))
.SetFilterDateAndTimeEnabled(AdvancedDataGridView_Main.Columns("Date"), True)
.SetSortEnabled(AdvancedDataGridView_Main.Columns("Patient"), False)
.SortDESC(AdvancedDataGridView_Main.Columns("Drug"))
End With
AdvancedDataGridViewSearchToolBar_Main.SetColumns(AdvancedDataGridView_Main.Columns)

End Sub

' Change Filter string when user selects one from the drop box
Private Sub AdvancedDataGridView_Main_FilterStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView_Main.FilterStringChanged
BindingSource_main.Filter = Me.AdvancedDataGridView_Main.FilterString
End Sub

' Change sort string when user selects (or clears) one from the drop box
Private Sub AdvancedDataGridView_Main_SortStringChanged(sender As Object, e As EventArgs) Handles AdvancedDataGridView_Main.SortStringChanged
BindingSource_main.Sort = Me.AdvancedDataGridView_Main.SortString
End Sub

Private Sub AdvancedDataGridViewSearchToolBar_Main_Search(sender As Object, e As Zuby.ADGV.AdvancedDataGridViewSearchToolBarSearchEventArgs) Handles AdvancedDataGridViewSearchToolBar_Main.Search
Dim startColumn As Integer = 0
Dim startRow As Integer = 0
Dim endcol As Boolean
Dim endrow As Boolean
If Not e.FromBegin Then
endcol = AdvancedDataGridView_Main.CurrentCell.ColumnIndex + 1 >= AdvancedDataGridView_Main.ColumnCount
endrow = AdvancedDataGridView_Main.CurrentCell.RowIndex + 1 >= AdvancedDataGridView_Main.RowCount
If endcol AndAlso endrow Then
startColumn = AdvancedDataGridView_Main.CurrentCell.ColumnIndex
startRow = AdvancedDataGridView_Main.CurrentCell.RowIndex

Else
startColumn = If(endcol, 0, AdvancedDataGridView_Main.CurrentCell.ColumnIndex + 1)
startRow = AdvancedDataGridView_Main.CurrentCell.RowIndex + If(endcol, 1, 0)
End If
End If
Dim c As DataGridViewCell = AdvancedDataGridView_Main.FindCell(e.ValueToSearch, _
If(e.ColumnToSearch IsNot Nothing, e.ColumnToSearch.Name, Nothing), _
startRow, _
startColumn, _
e.WholeWord, _
e.CaseSensitive)
If c IsNot Nothing Then
AdvancedDataGridView_Main.CurrentCell = c
End If

End Sub
End Class

```

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

Please find as an attachment the complete project and documentation as one ZIP ile

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

Detailed instructions

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: Zubyme **

Great!
Very thanks for you work!

Commented Unassigned: Project in visual basic [1418]

$
0
0
Hello
Please it could facilitate the project in vb?
Thanks
Comments: ** Comment from web user: ErickRosa **

I know maybe this will be abusing your time, but may you consider adding something like:

.DisableFilterKeepSort(.Columns(0))

on your next version to your events list meaning that there will be no filter section on the column but the user can still sort ascending descending (often used on ID columns at least by me)?

***** 5 starts to your work

Viewing all 198 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>