0
Hello, I have a Grid and I am making some data changes for display, explaining better, in my database I saved the data with only one value: "V", "A", "O", and I want to make changes for display, as shows the switch
.
function criador_linhas(s, e) {
if (s.rowType == "data") {
switch (s.data.CatVen_Tipo) {
case "V":
s.data.CatVen_Tipo1 = "Venda Avulsa";
break;
case "A":
s.data.CatVen_Tipo1 = "Ambos";
break;
case "O":
s.data.CatVen_Tipo1 = "Orçamento/Projeto";
break;
default:
s.data.CatVen_Tipo1 = "Erro";
break;
}
}
}
My database:
The problem is this, it fills some values, but others it leaves empty, as shown in the image:
My Datagrid:
@(Html.DevExtreme().DataGrid()
.ShowBorders(true)
.Height(355)
.Selection(s => s.Mode(SelectionMode.Single))
.DataSource(Model, new string[] { "CatVen_Codigo" })
.Columns(columns =>
{
columns.Add().DataField("CatVen_Codigo").Width(100).Caption("Código");
columns.Add().DataField("CatVen_Descricao").Caption("Descrição");
columns.Add().DataField("CatVen_Tipo1").Width(120).Caption("Tipo");
columns.Add().DataField("CatVen_Ativo").Width(120).Caption("Situação");
}).OnSelectionChanged("selection_changed")
.Paging(p => p.PageSize(10))
.FilterRow(f => f.Visible(true))
.HeaderFilter(f => f.Visible(true))
.OnRowPrepared("criador_linhas")
.GroupPanel(p => p.Visible(true))
.GroupPanel(p => p.EmptyPanelText("Arraste uma coluna até aqui para agrupar por essa coluna"))
.NoDataText("Nada encontrado")
.Grouping(g => g.AutoExpandAll(false))
.RemoteOperations(true)
.LoadPanel(loadPanel => loadPanel.Enabled(false))
.Scrolling(scrolling => scrolling.Mode(GridScrollingMode.Infinite))
)
Make sure the field
s.rowType
is being filled in asdata
, or even withdraw the validation to test. It is also good to check in the browser console if you are not having any error, because if there is an error in the fill as for example an access to an invalid object will happen to break too.– Leonardo Getulio
Check by console.log or Alert if the information is coming in correctly, and if there are no spaces or other additional character types in the string.
– Lucas Souza