Hello,
We are using your DropdownList to show Countries in our UI.
But we would like to have all our neighbour countries as favourites in the first few places.
How can we achieve this without using Grouping?
Thanks for your help.
Regards Dominic
public class Vegetables
{
public string Vegetable { get; set; }
public string Category { get; set; }
public string Id { get; set; }
public bool Favorite { get; set; }
public List<Vegetables> VegetablesList()
{
List<Vegetables> veg = new List<Vegetables>();
veg.Add(new Vegetables { Vegetable = "Cabbage Leafy and Salad", Category = "Leafy and Salad", Favorite = false });
veg.Add(new Vegetables { Vegetable = "Chickpea", Category = "Beans", Favorite = false });
veg.Add(new Vegetables { Vegetable = "Garlic", Category = "Bulb and Stem", Favorite=true });
veg.Add(new Vegetables { Vegetable = "Green bean", Category = "Beans", Favorite = false });
veg.Add(new Vegetables { Vegetable = "Horse gram", Category = "Beans", Favorite=true });
veg.Add(new Vegetables { Vegetable = "Nopal", Category = "Bulb and Stem", Favorite=false });
veg.Add(new Vegetables { Vegetable = "Onion", Category = "Bulb and Stem", Favorite = false });
veg.Add(new Vegetables { Vegetable = "Pumpkins", Category = "Leafy and Salad", Favorite = false });
veg.Add(new Vegetables { Vegetable = "Spinach", Category = "Leafy and Salad", Favorite = true });
return veg.OrderByDescending(o => o.Favorite).ToList();
}
}
public IActionResult Index()
{
ViewBag.data = new Vegetables().VegetablesList();
return View();
}
|
Thank you very much!
This is totally what I was looking for :-)
Where do you have documented all those Special Attributes we can use in Syncfusion, as I am not able to find them in the documentation.
Regards Dominic
I have an additional question.
How can I achieve this in the Grid Edit Modal?
I pass that information to the Grid:
But then in the Grid Edit Modal, I can only see this:
So this list is not sorted or anything.
Is there any possibility to achieve this?
Hello Berly,
Is your requirement to change the sort order of the data in the edit dropdown list?
-> This is exactly what we want.
We were able to sort the Dropdown values in a normal dropdown.
But this is not applied in the Grid Edit Modal (DropDownEdit).
So there has to be a possibility to achieve this in some way. But I can't find out how to.
My requirement:
I need an EJ-Grid
Drop-Down
edit, where I can set Switzerland and other Countries to the top of the list.
With this favorite prop, I could achieve this in the Grid Edit. I could do it only in a normal drop-down edit.
When I add those favorite tags:
And order them in the controller by Favorite, DisplayName then no sort will be visible in the EJ-Grid Drop-Down edit modal.
So my question is:
How can I sort them in the Grid
Drop-Down
edit?
Is there some JS code I have to run?
Or how can I change the sort order in the Grid Drop-Down?
I hope my needs are clear, if not please ask back.
Best Regards