What is the XAML code needed to add filters to a ListView in a Mashup in Lawson Smart Office? The solution is to put a StackPanel with a Label and a TextBox inside the GridViewColumn:
<GridViewColumn> <StackPanel> <Label Content="Location" Foreground="White" /> <TextBox Name="WHSL" /> </StackPanel> </GridViewColumn>
Here is a screenshot of a desired M3 program (for example: MWS060/B) with filters in the list (in this case: Receiving number, Location, and Lot number); we want to reproduce that list and its filters as a Mashup:
And here is the resulting Mashup with the filters in the list; the result is surprisingly similar to the actual M3 panel:
The particular Mashup shown in the screenshot above calls a REST Web Service made with JSP and which is not provided here. The Mashup passes the values of the filters as parameters of the Web Service in the URL. The Web Service executes SQL against M3 using JDBC and returns the result set as XML. Finally, the Mashup displays the resulting XML in the ListView as data in columns and rows. Here’s the full XAML code of that Mashup:
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" Margin="10"> <Grid.Resources> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <StackPanel Orientation="Horizontal" Grid.Row="0"> <Label Content="Warehouse" VerticalAlignment="Center" Margin="3" /> <TextBox Name="WHLO" VerticalAlignment="Center" Margin="3" /> <Label Content="Item number" VerticalAlignment="Center" Margin="3" /> <TextBox Name="ITNO" VerticalAlignment="Center" Margin="3" /> <Label Content="Container" VerticalAlignment="Center" Margin="3" /> <TextBox Name="CAMU" VerticalAlignment="Center" Margin="3" /> <Button Content="Apply" IsDefault="True" VerticalAlignment="Center" Margin="3" Width="55"> <Button.CommandParameter> <mashup:Event TargetName="WebService" TargetEventName="List"> <mashup:Parameter SourceKey="WHLO" Value="{Binding ElementName=WHLO, Path=Text}" /> <mashup:Parameter SourceKey="ITNO" Value="{Binding ElementName=ITNO, Path=Text}" /> <mashup:Parameter SourceKey="CAMU" Value="{Binding ElementName=CAMU, Path=Text}" /> <mashup:Parameter SourceKey="REPN" Value="{Binding ElementName=REPN, Path=Text}" /> <mashup:Parameter SourceKey="WHSL" Value="{Binding ElementName=WHSL, Path=Text}" /> <mashup:Parameter SourceKey="BANO" Value="{Binding ElementName=BANO, Path=Text}" /> </mashup:Event> </Button.CommandParameter> </Button> </StackPanel> <mashup:DataListPanel Name="WebService" Grid.Row="1" Margin="3"> <mashup:DataListPanel.Events> <mashup:Events> <mashup:Event SourceEventName="Startup" /> </mashup:Events> </mashup:DataListPanel.Events> <mashup:DataListPanel.DataService> <mashup:DataService Type="REST"> <mashup:DataService.Operations> <mashup:DataOperation Name="List"> <mashup:DataParameter Key="REST.BaseAddress" Value="http://hostname/ItemSearchMashup.jsp?WHLO={WHLO}&ITNO={ITNO}&CAMU={CAMU}&REPN={REPN}&WHSL={WHSL}&BANO={BANO}" /> <mashup:DataParameter Key="REST.RemoveNamespace" Value="True" /> <mashup:DataParameter Key="REST.XPath" Value="root/r" /> </mashup:DataOperation> </mashup:DataService.Operations> </mashup:DataService> </mashup:DataListPanel.DataService> <ListView Name="Customers" ItemsSource="{Binding Items}" Style="{DynamicResource styleListView}" ItemContainerStyle="{DynamicResource styleListViewItem}"> <ListView.View> <GridView ColumnHeaderContainerStyle="{DynamicResource styleGridViewColumnHeader}"> <GridView.Columns> <GridViewColumn Header="Whs" DisplayMemberBinding="{Binding XPath=MLWHLO}" /> <GridViewColumn DisplayMemberBinding="{Binding XPath=MLREPN}"> <StackPanel> <Label Content="Recvng no" Margin="0" Foreground="White" /> <TextBox Name="REPN" Margin="0" /> </StackPanel> </GridViewColumn> <GridViewColumn Header="Item number" DisplayMemberBinding="{Binding XPath=MLITNO}" /> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding XPath=MMITDS}" /> <GridViewColumn Header="Supplier" DisplayMemberBinding="{Binding XPath=LMSUNO}" /> <GridViewColumn DisplayMemberBinding="{Binding XPath=MLWHSL}"> <StackPanel> <Label Content="Location" Margin="0" Foreground="White" /> <TextBox Name="WHSL" Margin="0" /> </StackPanel> </GridViewColumn> <GridViewColumn DisplayMemberBinding="{Binding XPath=MLBANO}"> <StackPanel> <Label Content="Lot number" Margin="0" Foreground="White" /> <TextBox Name="BANO" Margin="0" /> </StackPanel> </GridViewColumn> <GridViewColumn Header="On-hand" DisplayMemberBinding="{Binding XPath=MLSTQT}" /> <GridViewColumn Header="Allocatble" DisplayMemberBinding="{Binding XPath=Allocatble}" /> <GridViewColumn Header="Sts" DisplayMemberBinding="{Binding XPath=MLSTAS}" /> <GridViewColumn Header="M dt" DisplayMemberBinding="{Binding XPath=LMMFDT}" /> <GridViewColumn Header="Exp dt" DisplayMemberBinding="{Binding XPath=LMEXPI}" /> <GridViewColumn Header="Sls dt" DisplayMemberBinding="{Binding XPath=LMSEDT}" /> </GridView.Columns> </GridView> </ListView.View> </ListView> </mashup:DataListPanel> </Grid>
That’s it!