Hi, I am trying to load some controls in to the Dialog grid template with icons appended. First issue is, the icons does not show straightaway when you double click a grid row and when the dialog box opens up. It only shows the icon when you click on the control itself. The icons should be shown for both Email and Mobile controls. See Image 1
Second issue is, the focused controls keep highlighted when clicked on a different control. See Image 2
I am using the following code to achieve this.
<div class="form-row">
<div class="form-group col-md-6">
<SfTextBox @ref="sftPrefferredContactIconEmail" ID="Email" @bind-Value="@User.Email" FloatLabelType="FloatLabelType.Always" Placeholder="Email" Created="@PrefferredContactIconForEmail"> </SfTextBox>
</div>
<div class="form-group col-md-6">
<SfTextBox @ref="sftPrefferredContactIconMobile" ID="Mobile" @bind-Value="@User.Mobile" FloatLabelType="FloatLabelType.Always" Placeholder="Mobile" Created="@PrefferedContactIconForMobile"></SfTextBox>
</div>
</div>
@code
{
SfTextBox? sftPrefferredContactIconMobile;
SfTextBox? sftPrefferredContactIconEmail;
public void PrefferedContactIconForMobile()
{
this.sftPrefferredContactIconMobile?.AddIconAsync("append", "e-icons e-radio-button");
}
public void PrefferredContactIconForEmail()
{
this.sftPrefferredContactIconEmail?.AddIconAsync("append", "e-icons e-radio-button");
}
}
Can you please help me to correct these issues? Thank you.
Harry.
|
<SfGrid DataSource="@GridData" Toolbar="@(new string[] {"Add", "Edit" ,"Delete","Update","Cancel" })">
<GridEvents OnActionComplete="ActionCompletedHandler" TValue="OrdersDetails"></GridEvents>
. . .
<GridColumns>
. . .
</SfGrid>
@code{
SfTextBox customerTextBoxRef;
SfTextBox shipaddressTextBoxRef;
private async Task CreatedHandler(Object args)
{
await this.customerTextBoxRef?.AddIconAsync("append", "e-icons e-radio-button");
}
private async Task CreatedHandler1(Object args)
{
await this.shipaddressTextBoxRef?.AddIconAsync("append", "e-icons e-radio-button");
}
public void ActionCompletedHandler(ActionEventArgs<OrdersDetails> args)
{
if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Add) || args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.BeginEdit))
{
//based on Add or Edit action disable the PreventRender
args.PreventRender = false;
}
}
. . .
} |
|
|
Hi Rahul,
Thank you so much for your excellent answer. Your examples helped me to resolve all the issues I had. The label issue was due to setting up "FloatLabelType="@FloatLabelType.Always"" in controls itself. Changing them to individual labels as stated in your example resolved it. However, I still think it could be an issue if someone wants to go about showing the labels that way. Try setting up a controller as below and see if you can reproduce the issue.
<SfTextBox ID="FirstName" @bind-Value="@User.FirstName" FloatLabelType="@FloatLabelType.Always" Placeholder="First Name"></SfTextBox>
Also, to answer the IsPrimaryKey question you raised, I have setup the userName to be the primary key in my scenario as below.
<GridColumn Field=@nameof(User.UserName) IsPrimaryKey="true" HeaderText="UserName" Width="100%"></GridColumn>
Thank you very much.
|
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Dialog">
<Template>
@{
var Order = (context as OrdersDetails);
<div>
<div class="form-row">
<div class="form-group col-md-6">
<label class="e-float-text e-label-top">Order ID</label>
<SfNumericTextBox ID="OrderID" @bind-Value="@(Order.OrderID)" Enabled="@((Order.OrderID == null) ? true : false)"></SfNumericTextBox>
</div>
<div class="form-group col-md-6">
@*<label class="e-float-text e-label-top">Customer Name</label>*@
<SfTextBox @ref="customerTextBoxRef" ID="CustomerID" @bind-Value="@(Order.CustomerID)"
Placeholder="Customer Name" FloatLabelType="FloatLabelType.Always" Created="@CreatedHandler"></SfTextBox>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
@*<label class="e-float-text e-label-top">Ship Address</label>*@
<SfTextBox @ref="shipaddressTextBoxRef" ID="ShipAddress" @bind-Value="@(Order.ShipAddress)"
Placeholder="Ship Address" FloatLabelType="FloatLabelType.Always" Created="@CreatedHandler1"></SfTextBox>
</div>
</div>
. . .
</div>
}
</Template>
</GridEditSettings> |