Skip to content

Commit

Permalink
CODE:: adjust code gerate columns datagrid
Browse files Browse the repository at this point in the history
  • Loading branch information
bachtiarpanjaitan committed Oct 4, 2024
1 parent 00f1c95 commit ff40de2
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 16 deletions.
4 changes: 0 additions & 4 deletions Bepe/Components/SideMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ public class SideMenu
public event EventHandler<EventHandlerPageArgs> ItemTapped;
public Dictionary<string, MenuItemPage> MenuItems;
public Dictionary<string, Button> MenuButtons = new();
public SideMenu()
{

}

public VerticalStackLayout CreateSideMenu()
{
Expand Down
6 changes: 6 additions & 0 deletions Bepe/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public void DefineLayoutTwoColumn()
{
m.Value.TextColor = Colors.DarkOrange;
m.Value.FontSize = 14;
m.Value.IsEnabled = true;
}
else
{
m.Value.IsEnabled = false;
m.Value.BackgroundColor = Colors.Transparent;
}
}
};
Expand Down
9 changes: 8 additions & 1 deletion Pages/Views/BaseView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ public class BaseView : ContentView
public void ResetView()
{
DatagridProvider.Reset();
DatagridProvider.DataGrid.BindingContext = null;
}

public void SetDatagridColumns(List<ColumnType> columns)
{
foreach (var c in columns.Select(col => col.Create()))
{
DatagridProvider.DataGrid.Columns.Add(c);
}
}

public void SetContextMenuHandler(MenuFlyout ContextMenu, ContextMenuHandlers handler)
Expand Down
4 changes: 2 additions & 2 deletions Pages/Views/GridDataBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public GridDataBarang()
new () { Type = ColumnTypes.Numeric,MappingName = "id", TextAlignment = TextAlignment.Center,ColumnMode = ColumnWidthMode.FitByCell ,HeaderText = "ID", Format = "N0" },
new() { Type = ColumnTypes.Text, MappingName = "kode", HeaderText = "KODE" },
new() { Type = ColumnTypes.Text, MappingName = "nama", HeaderText = "NAMA BARANG"},
new() { Type = ColumnTypes.Image, MappingImage = "resourceGambar" ,MappingName = "resourceGambarThumbnail", Width = 110, HeaderText = "GAMBAR", ImageHeight = 50, ImageWidth = 50}
// new() { Type = ColumnTypes.Image, MappingImage = "resourceGambar" ,MappingName = "resourceGambarThumbnail", Width = 110, HeaderText = "GAMBAR", ImageHeight = 50, ImageWidth = 50}
];
foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);;
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
3 changes: 1 addition & 2 deletions Pages/Views/GridDataHargaBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public GridDataHargaBarang()
new() { Type = ColumnTypes.Text, MappingName = "basic_unit_nama", HeaderText = "SATUAN DASAR"},
new() { Type = ColumnTypes.Date, MappingName = "tanggal_berlaku", HeaderText = "TANGGAL BERLAKU"},
];

foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridDataKasir.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public GridDataKasir()
new ColumnType { Type = ColumnTypes.Text, MappingName = "avatar", HeaderText = "TELEPON"},
new ColumnType { Type = ColumnTypes.Text, MappingName = "status", HeaderText = "STATUS"}
];
foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridDataPelanggan.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GridDataPelanggan()
new ColumnType { Type = ColumnTypes.Text, MappingName = "telepon", HeaderText = "TELEPON"},
new ColumnType { Type = ColumnTypes.Text, MappingName = "alamat", HeaderText = "ALAMAT"}
];
foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridDataPemasok.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GridDataPemasok()
new ColumnType { Type = ColumnTypes.Text, MappingName = "telepon", HeaderText = "TELEPON"},
new ColumnType { Type = ColumnTypes.Text, MappingName = "alamat", HeaderText = "ALAMAT"}
];
foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridDataSatuanBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public GridDataSatuanBarang()
new ColumnType { Type = ColumnTypes.Numeric, TextAlignment = TextAlignment.End ,MappingName = "konversi", HeaderText = "NILAI KONVERSI", Format = "N0"}
];

foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridDataSatuanDasarBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GridDataSatuanDasarBarang()
new() { Type = ColumnTypes.Text, MappingName = "nama", HeaderText = "NAMA SATUAN"},
];

foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridPenerimaanBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public GridPenerimaanBarang()
new() { Type = ColumnTypes.Text, MappingName = "Keterangan", HeaderText = "KETERANGAN"}
];

foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down
2 changes: 1 addition & 1 deletion Pages/Views/GridStokBarang.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public GridStokBarang()
new() { Type = ColumnTypes.Text, MappingName = "basic_unit_name", HeaderText = "SATUAN"}
];

foreach (var c in columns.Select(col => col.Create())) DatagridProvider.DataGrid.Columns.Add(c);
SetDatagridColumns(columns);
Content = DatagridProvider.LayoutDatagrid;

DatagridProvider.ShowLoader();
Expand Down

0 comments on commit ff40de2

Please sign in to comment.