Dropzone item text selecting?

I’ve got a dropzone with two containers. Both show a list of items to recreate a grid of records which can be reordered by drag and drop. In each of these items there is a text field to allow for some editing of the item data. How can I select the correct item’s text field to automatically select all the text on clicking on the text field? The code that I currently have will select the bottom record’s text no matter which item it is that I select.

Here is the code.

<MudDropContainer T="ProjectBatchColumns" Items="lstProjClosingField" ItemsSelector="@((item,dropzone) => item.Identifier == dropzone)" ItemDropped="ItemUpdated"
    Class="d-block flex-wrap flex-grow-1" @ref="content">
    <ChildContent>
        <MudDropZone T="ProjectBatchColumns" Identifier="Drop Zone 1" Class="rounded mud-background-gray pa-6 ma-8 flex-grow-1" AllowReorder="true"
                     ItemIsDisabled="@( (item) => item.Visible == false || item.Sequence < 0)" @ref="DZ1">
            <MudText Typo="Typo.h6">Visible Columns</MudText>
            <MudText Class="mb-4">Drag and drop to reorder.</MudText>
        </MudDropZone>
        <MudDropZone T="ProjectBatchColumns" Identifier="DropZone1" Class="rounded mud-background-gray pa-6 ma-8 flex-grow-1" AllowReorder="true"
                     ItemIsDisabled="@( (item) => item.Visible == false || item.Sequence < 0)">
            <MudText Typo="Typo.h6">Hidden Columns</MudText>
            <MudText Class="mb-4">Mark the column as visible to modify order.</MudText>
        </MudDropZone>
    </ChildContent>
    <ItemRenderer>
        <MudPaper Class="pa-4 my-4">
            <MudGrid style="align-items: center;">
                <MudItem xs="6" sm="4" Class="small-padding">
                    Name<br /><MudText Style="display:inline-flex">@context.Name</MudText>
                </MudItem>
                <MudItem xs="6" sm="4" Class="small-padding">
                    Alias<br />
                    @if (context.AliasEditable)
                    {
                        <MudTextField @ref="selectedAlias" T="string" onfocus="@(async () => selectedAlias.SelectAsync())" Value="@context.Alias" ValueChanged="@(async (e) => { saveData("Alias", e, @context); })"></MudTextField>
                    }
                    else
                    {
                        <MudTextField T="string" Value="@context.Alias" ValueChanged="@(async (e) => { saveData("Alias", e, @context); })" Disabled="true"></MudTextField>
                    }
                </MudItem>
                <MudItem xs="6" sm="4" Class="small-padding">
                    Visible<br /><MudCheckBox T="bool" Checked="@context.Visible" CheckedChanged="@((e) => SaveBatchReview(context, "Visible", e))"></MudCheckBox>
                </MudItem>
            </MudGrid>
        </MudPaper>
    </ItemRenderer>
</MudDropContainer>

The idea is in the top list, any given item has a selectedAlias ref that when the text field gets the focus of it then highlights that record’s text so that the user can just start typing to make the edit. Right now, this code runs and when a text field is selected at any line, the last item’s text is the one which becomes the highlighted one.

What am I missing/doing wrong?

Thank you,

This ends up selecting the bottom item’s text and not the specific selected item’s text. Tried adjusting with various @ref items to find the specific one. Tried accessing the dropzone’s item collection but can’t seem to get to it. Tried using an onclick function but can’t get at the underlining object to select the text, just the context data of the item.

New contributor

seth monkey is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật