|
<EditForm EditContext="@mvmEditContext" OnSubmit="@StartMatch">
<DataAnnotationsValidator />
<ValidationSummary />
<div style="display:flex; justify-content:space-between; align-items:baseline; margin-top:3rem">
<div>
<div>
<h3>
Player One
</h3>
</div>
<SfAutoComplete TValue="string" TItem="OrderDetails" Placeholder="Select a Player" Query="@RemoteDataQuery" @bind-Value="@matchViewModel.Player1Name" FloatLabelType="FloatLabelType.Auto" AllowCustom="true">
<SfDataManager Url=https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders CrossDomain="true" Adaptor="Syncfusion.Blazor.Adaptors.ODataAdaptor"></SfDataManager>
<AutoCompleteFieldSettings Text="CustomerID" Value="CustomerID"></AutoCompleteFieldSettings>
<AutoCompleteEvents Filtering="Filtering" TItem="OrderDetails" TValue="string"></AutoCompleteEvents>
<AutoCompleteTemplates TItem="OrderDetails">
<NoRecordsTemplate>
@* <SfButton @onclick="@(e => AddPlayerDialog(e,1))">Add Player</SfButton>
*@
</NoRecordsTemplate>
</AutoCompleteTemplates>
</SfAutoComplete>
</div>
</div>
<div style="display:flex; justify-content:center; margin-top:5em;">
<button class="btn btn-primary" type="submit">Start Match</button>
</div>
</EditForm>
@code {
private SfAutoComplete<string, OrderDetails> Player1Obj;
public MatchViewModel matchViewModel = new MatchViewModel();
public Query RemoteDataQuery = new Query().Select(new List<string> { "CustomerID" }).Take(6);
private string BaseUri;
private EditContext mvmEditContext;
private ValidationMessageStore validationMessageStore;
public class MatchViewModel
{
[Required(AllowEmptyStrings = false)]
public string TournamentName { get; set; }
[Required(AllowEmptyStrings = false)]
public string Draw { get; set; }
[Required(AllowEmptyStrings = false)]
public string Round { get; set; }
[Required(AllowEmptyStrings = false)]
public string MatchType { get; set; }
[Required(AllowEmptyStrings = false)]
public string Player1Name { get; set; }
[Required(AllowEmptyStrings = false)]
public string Player2Name { get; set; }
public int PlayerServingFirst { get; set; }
}
protected override void OnInitialized()
{
// BaseUri = config["apiUrl"];
mvmEditContext = new(matchViewModel);
}
} |
|
<EditForm Model="@matchViewModel" OnValidSubmit="@StartMatch">
<DataAnnotationsValidator />
<ValidationSummary />
<div style="display:flex; justify-content:space-between; align-items:baseline; margin-top:3rem">
<div>
<div>
<h3>
Player One
</h3>
</div>
<SfAutoComplete ID="player1" MinLength="2" @ref="Player1Obj" TValue="string" TItem="OrderDetails" Placeholder="Select a Player" Query="@RemoteDataQuery" @bind-Value="@matchViewModel.Player1Name" FloatLabelType="FloatLabelType.Auto" AllowCustom="false">
<SfDataManager Url=https://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/Orders CrossDomain="true" Adaptor="Syncfusion.Blazor.Adaptors.ODataAdaptor"></SfDataManager>
<AutoCompleteFieldSettings Text="CustomerID" Value="CustomerID"></AutoCompleteFieldSettings>
<AutoCompleteEvents Filtering="Filtering" TItem="OrderDetails" TValue="string"></AutoCompleteEvents>
<AutoCompleteTemplates TItem="OrderDetails">
<NoRecordsTemplate>
@* <SfButton @onclick="@(e => AddPlayerDialog(e,1))">Add Player</SfButton>
*@
</NoRecordsTemplate>
</AutoCompleteTemplates>
</SfAutoComplete>
</div>
</div>
<div style="display:flex; justify-content:center; margin-top:5em;">
<button class="btn btn-primary" type="submit">Start Match</button>
</div>
</EditForm>
|