Lib.AspNetCore.Mvc.JqGrid
Lib.AspNetCore.Mvc.JqGrid copied to clipboard
Add support for custom searching
Hi Sir,
How can make the Gender read from database which I have table to stored the Gender Id & Name? How to make the enum
public enum Genders
{
Female = 1,
Male = 2,
Hermaphrodite = 3
}
to be read from dataContext instead hardcoded as above?
public Dictionary<string, string> GetGendersDictionary()
{
var list = _db.Gender.Select(t => new { t.Id, t.Name })
.ToDictionary(t => t.Id.ToString(), t => t.Name.ToString());
return list;
}
[JqGridColumnSearchable(typeof(DictionariesViewModel), "GetGendersDictionary", SearchType = JqGridColumnSearchTypes.Select, SearchOperators = JqGridSearchOperators.EqualOrNotEqual | JqGridSearchOperators.NullOperators)]
Please advise.
Regards, Micheale
@MichealeSee I'm not sure what is the actual issue you are having. My wild guess would be problem with injecting context into class providing dictionary, but I can't be sure without more details from you.