Jul 29, 2015, 4:45 PM
[CLOSED] error in gridpanel with reconfigure
I load a grid by code behind using reconfigure with List (Of columnBase ) . In the construction of columns , I declare the filter of the same coluna.Filter.Add(New Ext.Net.StringFilter) .
In the first loading of the page filter works normally, but when I click a button that will get the data back , the filters do not work anymore.
In the first loading of the page filter works normally, but when I click a button that will get the data back , the filters do not work anymore.
Public Sub popularGridValores()
Try
cr.dataDe = ctrDataInicio.SelectedDate.ToString("yyyyMMdd")
cr.dataAte = ctrDataFim.SelectedDate.ToString("yyyyMMdd")
cr.agrupamento = cbbAgrupamento.SelectedItem.Value
cr.pergunta = IIf(Me.cbbPergunta.SelectedItem.Value = Nothing, "", Me.cbbPergunta.SelectedItem.Value.Trim)
cr.pergunta = IIf(Me.cbbPergunta.SelectedItem.Value = Nothing, "", Me.cbbPergunta.SelectedItem.Value.Trim)
cr.campo = IIf(Me.cbbFiltrosParametrizados.SelectedItem.Value = Nothing, "", Me.cbbFiltrosParametrizados.SelectedItem.Value)
cr.itemPesquisa = IIf(Me.cbbFiltrarPadrao.SelectedItem.Value = Nothing, "", Me.cbbFiltrarPadrao.SelectedItem.Value)
cr.DescricaoCampo = cbbAgrupamento.SelectedItem.Text
cr.grupo = IIf(cbbGrupoOcorrencia.SelectedItem.Value Is Nothing, "0", cbbGrupoOcorrencia.SelectedItem.Value)
cr.tipo = IIf(cbbTipoOcorrencia.SelectedItem.Value Is Nothing, "0", cbbTipoOcorrencia.SelectedItem.Value)
cr.classificacao = IIf(cbbClassOcorrencia.SelectedItem.Value Is Nothing, "0", cbbClassOcorrencia.SelectedItem.Value)
cr.campoId = BuscarCampoId()
If cr.campoId Is Nothing Then
cr.campoId = ""
End If
If cr.dataDe = "00010101" Or cr.dataAte = "00010101" Then
Dim ano = Date.Now.Year
cr.dataDe = ano.ToString + "0401"
'cr.dataDe = "20150415"
cr.dataAte = Date.Now
cr.dataAte = cr.dataAte.ToDateString
End If
dt = cr.PopularDadosGridValores
Dim dt2 As New DataTable
dt2 = dt.Copy
Dim tamanhoDt As Integer
Dim numeroModels As String = "1"
Dim numeroLinhas As Integer
tamanhoDt = dt.Columns.Count
numeroLinhas = dt.Rows.Count
For indiceRemover = tamanhoDt - 1 To 3 Step -1
dt.Columns.RemoveAt(indiceRemover)
Next
For indiceAdicionar As Integer = 3 To tamanhoDt - 1
dt.Columns.Add(dt2.Columns(indiceAdicionar).ColumnName, Type.GetType("System.Double"))
dt.Columns.Add("ColunaLink/" & contadorNovaColuna.ToString)
contadorNovaColuna = contadorNovaColuna + 1
Next
Dim tamanhoDt2 As Integer = dt2.Columns.Count
tamanhoDt = dt.Columns.Count
Dim indiceColunaDt2 As Integer = 3
For indiceColuna As Integer = 3 To tamanhoDt - 1
Dim ano As String
Dim mes As String
Dim valor As String = ""
ano = dt2.Columns(indiceColunaDt2).ColumnName.Split("/")(0)
mes = dt2.Columns(indiceColunaDt2).ColumnName.Split("/")(1)
If IsNumeric(ano) Then
End If
For indiceLinha As Integer = 0 To numeroLinhas - 1
valor = dt2(indiceLinha)(indiceColunaDt2)
valor = Format(Convert.ToDouble(valor), "c").Trim
valor = valor.Replace("R$", "")
valor = valor.Replace(" ", "")
'valor = valor.Replace("R$", "").Replace(".", "").Replace(",", "")
Dim url = "/SOC/RELATORIOS/" & dt2(indiceLinha)("link") & "&D=" & ano & mes & "&CP=" & cr.campo & "&I=" & cr.itemPesquisa & "&CI=" & cr.campoId & "&DI=" & dt2(indiceLinha)(0).ToString.Replace(" ", "@") & "&G=" & cr.grupo & "&TQ=" & cr.tipo & "&CQ=" & cr.classificacao
dt(indiceLinha)(indiceColuna) = valor
dt(indiceLinha)(indiceColuna + 1) = url
Next
indiceColuna = indiceColuna + 1
indiceColunaDt2 = indiceColunaDt2 + 1
Next
For i As Integer = 0 To tamanhoDt - 2
Me.popularModel(dt.Columns(i).ColumnName, dt.Columns(i + 1).ColumnName, i)
Next
gridOcorrenciaMes.Reconfigure(lista)
Me.popularStore()
Catch ex As Exception
End Try
End Sub
Public Sub popularModel(ByVal nomeModel As String, ByVal nomeColunaLink As String, ByVal indice As Integer)
Try
Dim tipoAgrup As String = cbbAgrupamento.SelectedItem.Value
Dim colunaMes As String = nomeModel.Split("/")(0)
If indice <= 1 And tipoAgrup = "CTT_DESC01" Or indice = 1 And tipoAgrup <> "CTT_DESC01" Then
Me.AddField(New ModelField(nomeModel.ToString))
Dim coluna As New Ext.Net.Column
If indice = 1 Then
coluna.Flex = 5
Else
coluna.Flex = 1
End If
coluna.ID = "Col" & nomeModel.Replace("/", "").Replace(" ", "").Replace("\", "")
coluna.Text = nomeModel
coluna.DataIndex = nomeModel
coluna.Filterable = True
coluna.Filter.Add(New Ext.Net.StringFilter)
lista.Add(coluna)
ElseIf IsNumeric(colunaMes) Then
Me.AddField(New ModelField(nomeModel.ToString))
Dim hyperColumn As New Ext.Net.HyperlinkColumn
hyperColumn.Flex = 2
hyperColumn.Align = Alignment.Center
hyperColumn.ID = "Col" & nomeModel.Replace("/", "").Replace(" ", "").Replace("\", "")
hyperColumn.Text = nomeModel
hyperColumn.DataIndex = nomeModel
hyperColumn.Filterable = True
hyperColumn.Cls = "hypCol"
hyperColumn.Flex = 1
hyperColumn.DataIndexHref = nomeColunaLink
hyperColumn.Renderer.Fn = "linkColumn"
lista.Add(hyperColumn)
End If
contador += 1
Catch ex As Exception
End Try
End Sub
Last edited by Daniil; Aug 05, 2015 at 2:51 PM.
Reason: [CLOSED]