I created a gridview function that has as inputs: a data table and a meta data table. I would like to add functionality to this function so the user can sort the gridview by clicking on the header column.
I am open to other enhancements like a filter option or paging. Please specify the costs of these extra's.
## Deliverables
**Current function:**
Public Function MyGrid(ByVal dt As [login to view URL], ByVal dtFieldMetaData As [login to view URL]) As GridView
Dim grd As New GridView
Dim i As Integer
Dim the_val As String
[login to view URL] = [login to view URL]
[login to view URL] = dt
[login to view URL] = 9
[login to view URL] = [login to view URL](89, 161, 62)
[login to view URL] = [login to view URL]
[login to view URL] = [login to view URL](62,184, 69)
[login to view URL] = [login to view URL]
[login to view URL] = [login to view URL](153, 59, 2)[login to view URL] = [login to view URL]
[login to view URL]()
i = 0
For Each row In [login to view URL]
the_val = [login to view URL]("alignment")
If IsDBNull([login to view URL]("rpt_det_field_description")) = False Then [login to view URL](0).Cells(i).ToolTip = [login to view URL]("rpt_det_field_description")
End If
For j = 0 To [login to view URL] - 1
Select Case the_val
Case "L"
[login to view URL](j).Cells(i).HorizontalAlign = [login to view URL]
Case "R"
[login to view URL](j).Cells(i).HorizontalAlign = [login to view URL]
Case "M"
[login to view URL](j).Cells(i).HorizontalAlign = [login to view URL]
Case Else
[login to view URL](j).Cells(i).HorizontalAlign = [login to view URL]
End Select
Next j
i = i + 1
Next row
Return grd
End Function
**SAMPLE INPUT DATA:**
**1) The input table**
| Parameter | Waarde |
| --------------- | -------------------------------- |
| Run ID | 2 |
| Datum run | 20 Jan 2012 |
| Object | Verhuureenheid |
| Meester relatie | VERHUUREENHEID hoort bij COMPLEX |
**2) the meta data table**
<colgroup> <col /> <col /> <col /> <col /> <col /> <col /></colgroup>
| **form_id** | **rpt_det_fld_name** | **function_field_col_order** | **basic_type** | **alignment** | **rpt_det_field_descripion** |
| 196 | Parameter | 1 | CHAR | L | Bla bla |
| 196 | Waarde | 2 | CHAR | L | Bla bla |