- Disable Item Method
- Enabled
Contact Support
Disabled Items in ASP.NET CORE MultiSelect Control
19 Jun 20243 minutes to read
The MultiSelect provides options for individual items to be either in an enabled or disabled state for specific scenarios. The category of each list item can be mapped through the disabled field in the data table. Once an item is disabled, it cannot be selected as a value for the component. To configure the disabled item columns, use the fields.disabled
property.
In the following sample, State are grouped according on its category using disabled
field.
@{
List<Tag> tag = new List<Tag>();
tag.Add(new Tag() { Text = "Add to KB", State= false });
tag.Add(new Tag() { Text = "Crisis", State= false });
tag.Add(new Tag() { Text = "Enhancement", State= true });
tag.Add(new Tag() { Text = "Presale", State= false });
tag.Add(new Tag() { Text = "Needs Approval", State= false });
tag.Add(new Tag() { Text = "Approved", State= true });
tag.Add(new Tag() { Text = "Internal Issue", State= true });
tag.Add(new Tag() { Text = "Breaking Issue", State= false });
tag.Add(new Tag() { Text = "New Feature", State= true });
tag.Add(new Tag() { Text = "New Component", State= false });
tag.Add(new Tag() { Text = "Mobile Issue", State= false });
}
<div id='groupList' class='col-lg-6' style='padding-top:15px'>
<div class='content'>
<ejs-multiselect id="tags" placeholder="Select Tags" popupHeight="200px" dataSource="@tag">
<e-multiselect-fields value="Text" disabled="State" ></e-multiselect-fields>
</ejs-multiselect>
</div>
</div>
public class DisableStatusData
{
public string Status { get; set; }
public bool State { get; set; }
}
Disable Item Method
The disableItem method can be used to handle dynamic changing in disable state of a specific item. Only one item can be disabled in this method. To disable multiple items, this method can be iterated with the items list or array. The disabled field state will to be updated in the dataSource, when the item is disabled using this method. If the selected item is disabled dynamically, then the selection will be cleared.
Parameter | Type | Description |
---|---|---|
itemHTMLLIElement | HTMLLIElement |
It accepts the HTML Li element of the item to be removed. |
itemValue |
string | number | boolean | object
|
It accepts the string, number, boolean and object type value of the item to be removed. |
itemIndex | number |
It accepts the index of the item to be removed. |
Enabled
If you want to disabled the overall component to set the enabled property to false.