-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
209 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...orBootstrap.Demo.RCL/Components/Pages/Tabs/Tabs_Demo_15_Remove_Inactive_Tab_by_Name.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<div class="d-flex flex-column"> | ||
<Card> | ||
<CardBody> | ||
<Tabs @ref="tabsRef"> | ||
@foreach (var customer in customers) | ||
{ | ||
<Tab @key="@customer?.GetHashCode()" | ||
Title="@customer.CustomerName" | ||
Name="@($"{customer.CustomerId}")"> | ||
<Content> | ||
<div class="p-1"> | ||
<div class="mt-3"> | ||
This is the placeholder content for the <b>@customer.CustomerName</b> tab. | ||
</div> | ||
</div> | ||
</Content> | ||
</Tab> | ||
} | ||
</Tabs> | ||
</CardBody> | ||
</Card> | ||
</div> | ||
<div> | ||
<Button Color="ButtonColor.Success" Class="my-3" Size="ButtonSize.ExtraSmall" @onclick="RemoveCustomerVikram">x Remove Vikram Reddy Tab</Button> | ||
</div> | ||
|
||
@code { | ||
Tabs tabsRef = default!; | ||
|
||
int count = 1; | ||
private List<Customer> customers = default!; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
customers = new() { | ||
new(1, "Marvin Klein"), | ||
new(2, "Vikram Reddy"), | ||
new(3, "Bandita PA"), | ||
new(4, "Dan H"), | ||
new(5, "Joe JJ"), | ||
new(6, "Rose KK") | ||
}; | ||
count = customers.Count; | ||
} | ||
|
||
private void RemoveCustomerVikram() | ||
{ | ||
var customer = customers.FirstOrDefault(c => c.CustomerName == "Vikram Reddy"); | ||
if (customer != null) | ||
{ | ||
customers.Remove(customer); | ||
tabsRef.RemoveTabByName(customer.CustomerId.ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.