Hi team,
I tried the EditCellAsync. But It seems doesn't work with SFcombobox EditTemplate GridForeigncolumn. but it work with simple gridcolumn..
here is my code
I also attached the base code file and razor file.
//Code block
public async void KeyDownHandlerItem(KeyboardEventArgs args)
{
if (GridDetail.IsEdit && args.Key == "Enter")
{
await GridDetail.AddRecordAsync();
await GridDetail.EditCellAsync(RowIndexDetail, "ItemId");
}
}
//Razor
<GridForeignColumn Field=@nameof(DRdetailEdit.ItemId)
EditType="EditType.DefaultEdit"
HeaderText="Item"
ForeignKeyField="ItemId"
ForeignKeyValue="Description"
ForeignDataSource="@Items"
Width="110">
<EditTemplate>
<div @onkeydown="@(e => KeyDownHandlerItem(e))">
<SfComboBox @ref="ComboBoxItem"
ID="InventoryMasterID" TItem="InventoryMaster"
TValue="int"
AllowCustom="false"
Autofill="true"
Placeholder="Select Product"
CssClass="e-multi-column"
AllowFiltering="true"
PopupHeight="300px"
Width="110"
DataSource="@Items"
@bind-Value="@((context as DeliveryReceiptsDetailEdit).ItemId)">
<ComboBoxTemplates TItem="InventoryMaster">
<HeaderTemplate>
<table>
<tr>
<th class="e-text-center combo-width">ItemId</th>
<th>Description</th>
@*<th>UnitCost</th>
<th>Size</th>*@
</tr>
</table>
</HeaderTemplate>
<ItemTemplate Context="ComboContext">
<table>
<tbody>
<tr>
<td class="e-text-center combo-width">@((ComboContext as InventoryMaster).ItemId)</td>
<td>@((ComboContext as InventoryMaster).Description)</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</ComboBoxTemplates>
<ComboBoxFieldSettings Value="ItemId" Text="Description"></ComboBoxFieldSettings>
<ComboBoxEvents TItem="InventoryMaster" TValue="int" Created="Created" ValueChange="OnValueChangeItem"></ComboBoxEvents>
</SfComboBox>
</div>
</EditTemplate>
<HeaderTemplate>
<div>
<span class="oi oi-fire e-icons headericon"></span> Item
</div>
</HeaderTemplate>
</GridForeignColumn>
Hope you can help me.
Best Regards,
Tyrone
Thanks Vignesh Natarajan for update
I'm trying to create a POS like entry.. I'm using autocomplete sfcombobox as I posted in my first post.
Here are the steps
1) after I selected an item and press enter (same with barcode scanning like in groceries). it will automatically added a new row..
2) And then should set focus (with cursor) in the product item column of the new row for item selection..
I'm done with number 1)
but no success with number 2).
It need to doubleclick the cell just to get the cursor on. and this consumes time.
It goes like this as of now..
and I need it to go like this..
with editing cursor after adding of new row..
I tried Editcellasync. but seems it not worked with Gridcolumn with SFcombobox EditTemplate .
Hope you can help me.
Best Regards,
Tyrone
|
public async void KeyDownHandlerItem(KeyboardEventArgs args)
{
if (GridDetail.IsEdit && args.Key == "Tab")
{
await GridDetail.EditCellAsync(RowIndexDetail, "OrderDate");
}
if (GridDetail.IsEdit && args.Key == "Enter")
{
await GridDetail.AddRecordAsync();
await Task.Delay(100);
await GridDetail.EditCellAsync(RowIndexDetail, "EmployeeID");
}
}
|
Thanks Vignesh Natarajan for the update.
It did not work with with my program..
must be something to do with my model class entity..
I'll try to do some isolation.
Best Regards,
Tyrone